From 20d28e80a5c861a9d5f449ea911ab75b4f37ad0d Mon Sep 17 00:00:00 2001 From: Jef Date: Tue, 24 Sep 2024 14:54:57 +0200 Subject: Initial community commit --- Src/nsmkv/vint.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 Src/nsmkv/vint.h (limited to 'Src/nsmkv/vint.h') diff --git a/Src/nsmkv/vint.h b/Src/nsmkv/vint.h new file mode 100644 index 00000000..03c7c284 --- /dev/null +++ b/Src/nsmkv/vint.h @@ -0,0 +1,14 @@ +#pragma once +#include + +uint8_t vint_get_number_bytes(uint8_t first_byte); +/* call if you already know the len (e.g. from vint_get_number_bytes earlier */ +uint64_t vint_read_ptr_len(uint8_t len, const uint8_t *ptr); +int64_t vsint_read_ptr_len(uint8_t len, const uint8_t *ptr); + +/* don't call this unless you're sure that you have enough room in the buffer! */ +uint64_t vint_read_ptr(const uint8_t *ptr); +int64_t vsint_read_ptr(const uint8_t *ptr); + +/* values encoded as all 1's are supposed to indicate 'unknown value' */ +bool vint_unknown_length(uint8_t len, const uint8_t *ptr); \ No newline at end of file -- cgit