1 /*-------------------------------------------------------------------------
4 * POSTGRES disk "offset" definitions.
7 * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
8 * Portions Copyright (c) 1994, Regents of the University of California
10 * src/include/storage/off.h
12 *-------------------------------------------------------------------------
17 #include "storage/itemid.h"
21 * this is a 1-based index into the linp (ItemIdData) array in the
22 * header of each disk page.
24 typedef uint16 OffsetNumber
;
26 #define InvalidOffsetNumber ((OffsetNumber) 0)
27 #define FirstOffsetNumber ((OffsetNumber) 1)
28 #define MaxOffsetNumber ((OffsetNumber) (BLCKSZ / sizeof(ItemIdData)))
37 * True iff the offset number is valid.
39 #define OffsetNumberIsValid(offsetNumber) \
40 ((bool) ((offsetNumber != InvalidOffsetNumber) && \
41 (offsetNumber <= MaxOffsetNumber)))
46 * Increments/decrements the argument. These macros look pointless
47 * but they help us disambiguate the different manipulations on
48 * OffsetNumbers (e.g., sometimes we subtract one from an
49 * OffsetNumber to move back, and sometimes we do so to form a
50 * real C array index).
52 #define OffsetNumberNext(offsetNumber) \
53 ((OffsetNumber) (1 + (offsetNumber)))
54 #define OffsetNumberPrev(offsetNumber) \
55 ((OffsetNumber) (-1 + (offsetNumber)))