1*** /tmp/,RCSt1a21720 Wed Apr 3 11:49:55 1996 2--- page.h Wed Apr 3 08:42:25 1996 3*************** 4*** 158,163 5 6 #define PAIRFITS(P,K,D) ((PAIRSIZE((K),(D))) <= FREESPACE((P))) 7 #define BIGPAIRFITS(P) ((FREESPACE((P)) >= PAIR_OVERHEAD)) 8 #define FREESPACE(P) \ 9 ((OFFSET((P)) - PAGE_OVERHEAD - (NUM_ENT((P)) * PAIR_OVERHEAD))) 10 11 12--- 158,169 ----- 13 14 #define PAIRFITS(P,K,D) ((PAIRSIZE((K),(D))) <= FREESPACE((P))) 15 #define BIGPAIRFITS(P) ((FREESPACE((P)) >= PAIR_OVERHEAD)) 16+ /* 17+ * Since these are all unsigned, we need to guarantee that we never go 18+ * negative. Offset values are 0-based and overheads are one based (i.e. 19+ * one byte of overhead is 1, not 0), so we need to convert OFFSETs to 20+ * 1-based counting before subtraction. 21+ */ 22 #define FREESPACE(P) \ 23 ((OFFSET((P)) + 1 - PAGE_OVERHEAD - (NUM_ENT((P)) * PAIR_OVERHEAD))) 24 25*************** 26*** 159,165 27 #define PAIRFITS(P,K,D) ((PAIRSIZE((K),(D))) <= FREESPACE((P))) 28 #define BIGPAIRFITS(P) ((FREESPACE((P)) >= PAIR_OVERHEAD)) 29 #define FREESPACE(P) \ 30! ((OFFSET((P)) - PAGE_OVERHEAD - (NUM_ENT((P)) * PAIR_OVERHEAD))) 31 32 /* 33 * Overhead on header pages is just one word -- the length of the 34 35--- 165,171 ----- 36 * 1-based counting before subtraction. 37 */ 38 #define FREESPACE(P) \ 39! ((OFFSET((P)) + 1 - PAGE_OVERHEAD - (NUM_ENT((P)) * PAIR_OVERHEAD))) 40 41 /* 42 * Overhead on header pages is just one word -- the length of the 43