mirror of
https://github.com/pgvector/pgvector.git
synced 2026-07-05 20:20:59 +08:00
DRY neighbor array size [skip ci]
This commit is contained in:
@@ -208,7 +208,7 @@ HnswInitPage(Buffer buf, Page page)
|
||||
static HnswNeighborArray *
|
||||
HnswInitNeighborArray(int lm, HnswAllocator * allocator)
|
||||
{
|
||||
HnswNeighborArray *a = HnswAlloc(allocator, offsetof(HnswNeighborArray, items) + sizeof(HnswCandidate) * lm);
|
||||
HnswNeighborArray *a = HnswAlloc(allocator, HNSW_NEIGHBOR_ARRAY_SIZE(lm));
|
||||
|
||||
a->length = 0;
|
||||
a->closerSet = false;
|
||||
@@ -734,7 +734,7 @@ HnswSearchLayer(char *base, Datum q, List *ep, int ef, int lc, Relation index, F
|
||||
/* Create local memory for neighborhood if needed */
|
||||
if (index == NULL)
|
||||
{
|
||||
neighborhoodSize = offsetof(HnswNeighborArray, items) + sizeof(HnswCandidate) * HnswGetLayerM(m, lc);
|
||||
neighborhoodSize = HNSW_NEIGHBOR_ARRAY_SIZE(HnswGetLayerM(m, lc));
|
||||
neighborhoodData = palloc(neighborhoodSize);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user