shm_config.h 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. #pragma once
  2. #define BIG_CALIGNMENT 15488
  3. #define SMALL_CALIGNMENT 8
  4. #define SMALL_BYTES_TO_INDEX(bytes) ((bytes + 7) >> 3) // 小字节获取class index
  5. #define BIG_BYTES_TO_INDEX(bytes) ((bytes + (BIG_CALIGNMENT - 1)) >> 7) // 大字节获取class index
  6. #define CALIGNMENT_MAX_BYTES 0x2000LL // 对齐最大字节数
  7. #define BYTES_COMP_VALUE 0x400 // 大小字节数
  8. #define CLASS_TOTAL_BYTES 65536
  9. #define CLASS_MAX_BYTES 0x40000 // class 最大字节数
  10. #define MAX_CLASSS 32
  11. #define CLASS_MAX_COUNT 87 // 总共类数量
  12. #define PAGE_RIGHT_BIT 13 // 总共类数量
  13. #define BYTES_TO_PAGES(bytes) ((bytes) >> 13)
  14. #define PAGES_TO_BYTES(page) ((page) << 13)
  15. #define PALIGN_DOWN(x, align) ((x) & ~((align) - 1))
  16. #define PALIGN_UP(x, align) (((x) + ((align) - 1)) & (~((align) - 1)))
  17. namespace bg
  18. {
  19. namespace detail
  20. {
  21. namespace ShmConfig
  22. {
  23. constexpr size_t MAX_PAGE_COUNT = 0x7FFFFFFFFLL;
  24. }
  25. }
  26. }