diff options
author | Bruce Momjian <bruce@momjian.us> | 1998-09-07 05:35:48 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 1998-09-07 05:35:48 +0000 |
commit | 202751921d9a7adb0181bc0afd990a53e6015141 (patch) | |
tree | 44b62cb083afebf83339685b388132cce0f87298 /src/include/access/tupmacs.h | |
parent | e15807f4103034f42963cef17e39028c1dba58f7 (diff) |
Alignment cleanup so no more massive switch statements for alignment,
just two macros.
Diffstat (limited to 'src/include/access/tupmacs.h')
-rw-r--r-- | src/include/access/tupmacs.h | 51 |
1 files changed, 50 insertions, 1 deletions
diff --git a/src/include/access/tupmacs.h b/src/include/access/tupmacs.h index f81987f3823..df2b9ded3c1 100644 --- a/src/include/access/tupmacs.h +++ b/src/include/access/tupmacs.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: tupmacs.h,v 1.5 1998/09/01 03:27:37 momjian Exp $ + * $Id: tupmacs.h,v 1.6 1998/09/07 05:35:45 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -62,4 +62,53 @@ (char *) (T) \ ) +#define att_align(cur_offset, attlen, attalign) \ +( \ + ((attlen) < sizeof(int32)) ? \ + ( \ + ((attlen) == -1) ? \ + ( \ + ((attalign) == 'd') ? DOUBLEALIGN(cur_offset) : \ + INTALIGN(cur_offset) \ + ) \ + : \ + ( \ + ((attlen) == sizeof(char)) ? \ + ( \ + (cur_offset) \ + ) \ + : \ + ( \ + AssertMacro((attlen) == sizeof(short)), \ + SHORTALIGN(cur_offset) \ + ) \ + ) \ + ) \ + : \ + ( \ + ((attlen) == sizeof(int32)) ? \ + ( \ + INTALIGN(cur_offset) \ + ) \ + : \ + ( \ + AssertMacro((attlen) > sizeof(int32)), \ + ((attalign) == 'd') ? DOUBLEALIGN(cur_offset) : \ + LONGALIGN(cur_offset) \ + ) \ + ) \ +) + +#define att_addlength(cur_offset, attlen, attval) \ +( \ + ((attlen) != -1) ? \ + ( \ + (cur_offset) + (attlen) \ + ) \ + : \ + ( \ + (cur_offset) + VARSIZE(DatumGetPointer(attval)) \ + ) \ +) + #endif |