shm_config.h 1.1 KB

1234567891011121314151617181920212223242526272829303132
  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 PAGE_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 FREE_AREA_SIZE 0x20000LL
  14. #define BYTES_TO_PAGES(bytes) ((bytes) >> 13)
  15. #define PAGES_TO_BYTES(page) ((page) << 13)
  16. #define PALIGN_DOWN(x, align) ((x) & ~((align) - 1))
  17. #define PALIGN_UP(x, align) (((x) + ((align) - 1)) & (~((align) - 1)))
  18. namespace bg
  19. {
  20. namespace detail
  21. {
  22. namespace ShmConfig
  23. {
  24. constexpr size_t MAX_PAGE_COUNT = 0x7FFFFFFFFLL;
  25. }
  26. }
  27. }