#pragma once #define BIG_CALIGNMENT 15488 #define SMALL_CALIGNMENT 8 #define SMALL_BYTES_TO_INDEX(bytes) ((bytes + 7) >> 3) // 小字节获取class index #define BIG_BYTES_TO_INDEX(bytes) ((bytes + (BIG_CALIGNMENT - 1)) >> 7) // 大字节获取class index #define PAGE_BYTES 0x2000LL // 一页字节 #define BYTES_COMP_VALUE 0x400 // 大小字节数 #define CLASS_TOTAL_BYTES 65536 #define CLASS_MAX_BYTES 0x40000 // class 最大字节数 #define MAX_CLASSS 32 #define CLASS_MAX_COUNT 87 // 总共类数量 #define PAGE_RIGHT_BIT 13 // 总共类数量 #define FREE_AREA_SIZE 0x20000LL #define BYTES_TO_PAGES(bytes) ((bytes) >> 13) #define PAGES_TO_BYTES(page) ((page) << 13) #define PALIGN_DOWN(x, align) ((x) & ~((align) - 1)) #define PALIGN_UP(x, align) (((x) + ((align) - 1)) & (~((align) - 1))) namespace bg { namespace detail { namespace ShmConfig { constexpr size_t MAX_PAGE_COUNT = 0x7FFFFFFFFLL; } } }