diff --git a/src/hnsw.h b/src/hnsw.h index a2d6562..0b550a3 100644 --- a/src/hnsw.h +++ b/src/hnsw.h @@ -71,6 +71,9 @@ #define HnswGetLayerM(m, layer) (layer == 0 ? m * 2 : m) #define HnswGetMl(m) (1 / log(m)) +/* Ensure fits in uint8 */ +#define HnswGetMaxLevel(m) Min(((BLCKSZ - MAXALIGN(SizeOfPageHeaderData) - MAXALIGN(sizeof(HnswPageOpaqueData)) - offsetof(HnswNeighborTupleData, indextids) - sizeof(ItemIdData)) / (sizeof(ItemPointerData)) / m) - 2, 255) + /* Variables */ extern int hnsw_ef_search; @@ -288,7 +291,4 @@ void hnswrescan(IndexScanDesc scan, ScanKey keys, int nkeys, ScanKey orderbys, bool hnswgettuple(IndexScanDesc scan, ScanDirection dir); void hnswendscan(IndexScanDesc scan); -/* Ensure fits in uint8 */ -#define HnswGetMaxLevel(m) Min(((BLCKSZ - MAXALIGN(SizeOfPageHeaderData) - MAXALIGN(sizeof(HnswPageOpaqueData)) - offsetof(HnswNeighborTupleData, indextids) - sizeof(ItemIdData)) / (sizeof(ItemPointerData)) / m) - 2, 255) - #endif