diff options
Diffstat (limited to 'src/nc-util.h')
-rw-r--r-- | src/nc-util.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/nc-util.h b/src/nc-util.h index e94a222..d0afe28 100644 --- a/src/nc-util.h +++ b/src/nc-util.h @@ -151,4 +151,18 @@ static _nc_fn_inline span_t ncSpanSlice(span_t span, uint32_t offset, uint32_t s return slice; } +static _nc_fn_inline cspan_t ncSpanSliceC(cspan_t span, uint32_t offset, uint32_t size) +{ + cspan_t slice; + + DEBUG_ASSERT2(span.data != NULL, "Expected span to be non-null"); + DEBUG_ASSERT2(offset + size <= span.size, "Expected offset + size to be less than span size") + + /* Initialize slice, offset input data by the specified offset */ + ncSpanInitC(&slice, span.data + offset, size); + + return slice; +} + + #endif /* !_NC_UTIL_H */
\ No newline at end of file |