1996-08-28 03:59:28 +02:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* off.h--
|
1997-09-07 07:04:48 +02:00
|
|
|
* POSTGRES disk "offset" definitions.
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
|
|
|
*
|
|
|
|
* Copyright (c) 1994, Regents of the University of California
|
|
|
|
*
|
1997-09-08 04:41:22 +02:00
|
|
|
* $Id: off.h,v 1.4 1997/09/08 02:39:06 momjian Exp $
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
1997-09-07 07:04:48 +02:00
|
|
|
#ifndef OFF_H
|
1996-08-28 03:59:28 +02:00
|
|
|
#define OFF_H
|
|
|
|
|
|
|
|
/*
|
|
|
|
* OffsetNumber:
|
|
|
|
*
|
|
|
|
* this is a 1-based index into the linp (ItemIdData) array in the
|
|
|
|
* header of each disk page.
|
|
|
|
*/
|
1997-09-08 04:41:22 +02:00
|
|
|
typedef uint16 OffsetNumber;
|
1996-08-28 03:59:28 +02:00
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
#define InvalidOffsetNumber ((OffsetNumber) 0)
|
|
|
|
#define FirstOffsetNumber ((OffsetNumber) 1)
|
|
|
|
#define MaxOffsetNumber ((OffsetNumber) (BLCKSZ / sizeof(ItemIdData)))
|
|
|
|
#define OffsetNumberMask (0xffff) /* valid uint16 bits */
|
1996-08-28 03:59:28 +02:00
|
|
|
|
|
|
|
/* ----------------
|
1997-09-07 07:04:48 +02:00
|
|
|
* support macros
|
1996-08-28 03:59:28 +02:00
|
|
|
* ----------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* OffsetNumberIsValid --
|
1997-09-07 07:04:48 +02:00
|
|
|
* True iff the offset number is valid.
|
1996-08-28 03:59:28 +02:00
|
|
|
*/
|
|
|
|
#define OffsetNumberIsValid(offsetNumber) \
|
1997-09-07 07:04:48 +02:00
|
|
|
((bool) ((offsetNumber != InvalidOffsetNumber) && \
|
|
|
|
(offsetNumber <= MaxOffsetNumber)))
|
1996-08-28 03:59:28 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* OffsetNumberNext --
|
|
|
|
* OffsetNumberPrev --
|
1997-09-07 07:04:48 +02:00
|
|
|
* Increments/decrements the argument. These macros look pointless
|
|
|
|
* but they help us disambiguate the different manipulations on
|
|
|
|
* OffsetNumbers (e.g., sometimes we substract one from an
|
|
|
|
* OffsetNumber to move back, and sometimes we do so to form a
|
|
|
|
* real C array index).
|
1996-08-28 03:59:28 +02:00
|
|
|
*/
|
|
|
|
#define OffsetNumberNext(offsetNumber) \
|
1997-09-07 07:04:48 +02:00
|
|
|
((OffsetNumber) (1 + (offsetNumber)))
|
1996-08-28 03:59:28 +02:00
|
|
|
#define OffsetNumberPrev(offsetNumber) \
|
1997-09-07 07:04:48 +02:00
|
|
|
((OffsetNumber) (-1 + (offsetNumber)))
|
1996-08-28 03:59:28 +02:00
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
#endif /* OFF_H */
|