vint.h 602 B

1234567891011121314
  1. #pragma once
  2. #include <bfc/platform/types.h>
  3. uint8_t vint_get_number_bytes(uint8_t first_byte);
  4. /* call if you already know the len (e.g. from vint_get_number_bytes earlier */
  5. uint64_t vint_read_ptr_len(uint8_t len, const uint8_t *ptr);
  6. int64_t vsint_read_ptr_len(uint8_t len, const uint8_t *ptr);
  7. /* don't call this unless you're sure that you have enough room in the buffer! */
  8. uint64_t vint_read_ptr(const uint8_t *ptr);
  9. int64_t vsint_read_ptr(const uint8_t *ptr);
  10. /* values encoded as all 1's are supposed to indicate 'unknown value' */
  11. bool vint_unknown_length(uint8_t len, const uint8_t *ptr);