19 #ifdef USE_ASSERT_CHECKING
20 #define CHECK_ENCODING_ROUNDTRIP
81 #define MaxHeapTuplesPerPageBits 11
84 #define MaxBytesPerInteger 7
117 unsigned char *p = *ptr;
121 *(p++) = 0x80 | (
val & 0x7F);
124 *(p++) = (
unsigned char)
val;
136 unsigned char *p = *ptr;
146 val |= (
c & 0x7F) << 7;
151 val |= (
c & 0x7F) << 14;
156 val |= (
c & 0x7F) << 21;
161 val |= (
c & 0x7F) << 28;
166 val |= (
c & 0x7F) << 35;
205 unsigned char *endptr;
215 result->
first = ipd[0];
220 endptr = result->
bytes + maxbytes;
221 for (totalpacked = 1; totalpacked < nipd; totalpacked++)
224 uint64 delta =
val - prev;
237 unsigned char *p =
buf;
240 if (p -
buf > (endptr - ptr))
243 memcpy(ptr,
buf, p -
buf);
258 *nwritten = totalpacked;
265 #if defined (CHECK_ENCODING_ROUNDTRIP)
270 Assert(ndecoded == totalpacked);
302 char *endseg = ((
char *) segment) +
len;
305 unsigned char *endptr;
310 nallocated = segment->
nbytes * 2 + 1;
314 while ((
char *) segment < endseg)
317 if (ndecoded >= nallocated)
326 result[ndecoded] = segment->
first;
330 ptr = segment->
bytes;
335 if (ndecoded >= nallocated)
350 *ndecoded_out = ndecoded;
408 while (aptr -
a < na && bptr -
b < nb)
424 while (aptr -
a < na)
427 while (bptr -
b < nb)
430 *nmerged = dptr - dst;
#define SHORTALIGN_DOWN(LEN)
#define Assert(condition)
static int ginCompareItemPointers(ItemPointer a, ItemPointer b)
#define GinItemPointerGetOffsetNumber(pointer)
#define SizeOfGinPostingList(plist)
#define GinItemPointerSetBlockNumber(pointer, blkno)
#define GinNextPostingListSegment(cur)
#define GinItemPointerSetOffsetNumber(pointer, offnum)
#define GinItemPointerGetBlockNumber(pointer)
ItemPointer ginPostingListDecodeAllSegments(GinPostingList *segment, int len, int *ndecoded_out)
static uint64 itemptr_to_uint64(const ItemPointer iptr)
GinPostingList * ginCompressPostingList(const ItemPointer ipd, int nipd, int maxsize, int *nwritten)
int ginPostingListDecodeAllSegmentsToTbm(GinPostingList *ptr, int len, TIDBitmap *tbm)
static void encode_varbyte(uint64 val, unsigned char **ptr)
ItemPointer ginPostingListDecode(GinPostingList *plist, int *ndecoded_out)
static uint64 decode_varbyte(unsigned char **ptr)
#define MaxBytesPerInteger
#define MaxHeapTuplesPerPageBits
static void uint64_to_itemptr(uint64 val, ItemPointer iptr)
ItemPointer ginMergeItemPointers(ItemPointerData *a, uint32 na, ItemPointerData *b, uint32 nb, int *nmerged)
if(TABLE==NULL||TABLE_index==NULL)
static OffsetNumber ItemPointerGetOffsetNumber(const ItemPointerData *pointer)
ItemPointerData * ItemPointer
struct ItemPointerData ItemPointerData
static bool ItemPointerIsValid(const ItemPointerData *pointer)
void pfree(void *pointer)
void * repalloc(void *pointer, Size size)
#define OffsetNumberIsValid(offsetNumber)
static int cmp(const chr *x, const chr *y, size_t len)
unsigned char bytes[FLEXIBLE_ARRAY_MEMBER]
void tbm_add_tuples(TIDBitmap *tbm, const ItemPointer tids, int ntids, bool recheck)