variable_length.h 811 B

123456789101112131415161718192021222324252627282930
  1. /* Copyright 2015 Google Inc. All Rights Reserved.
  2. Distributed under MIT license.
  3. See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
  4. */
  5. /* Helper functions for woff2 variable length types: 255UInt16 and UIntBase128 */
  6. #ifndef WOFF2_VARIABLE_LENGTH_H_
  7. #define WOFF2_VARIABLE_LENGTH_H_
  8. #include <inttypes.h>
  9. #include <vector>
  10. #include "./buffer.h"
  11. namespace woff2 {
  12. size_t Size255UShort(uint16_t value);
  13. bool Read255UShort(Buffer* buf, unsigned int* value);
  14. void Write255UShort(std::vector<uint8_t>* out, int value);
  15. void Store255UShort(int val, size_t* offset, uint8_t* dst);
  16. size_t Base128Size(size_t n);
  17. bool ReadBase128(Buffer* buf, uint32_t* value);
  18. void StoreBase128(size_t len, size_t* offset, uint8_t* dst);
  19. } // namespace woff2
  20. #endif // WOFF2_VARIABLE_LENGTH_H_