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