pack.h 763 B

1234567891011121314151617181920212223242526272829
  1. #pragma once
  2. #include <util/system/types.h>
  3. const int MAX_BYTES_FOR_UI32 = 5; // max count of bytes to Pack(ui32) or PackU32()
  4. const int MAX_BYTES_FOR_UI64 = 9; // max count of bytes to PackU64()
  5. ////////////////////////////////////////////////////////////////////////////////
  6. //
  7. // Pack functions
  8. //
  9. int Pack(ui8* buf, ui32 value);
  10. ui32 Unpack(const ui8*& data);
  11. ////////////////////////////////////////////////////////////////////////////////
  12. //
  13. // PackU32:
  14. // 1. Preserves sort order
  15. // 2. Slightly more compact than 'Pack'
  16. //
  17. int PackU32(ui32 value, void* buf);
  18. int UnpackU32(ui32* value, const void* buf);
  19. int SkipU32(const void* buf);
  20. int PackU64(ui64 value, void* buf);
  21. int UnpackU64(ui64* value, const void* buf);
  22. int SkipU64(const void* buf);