summaryrefslogtreecommitdiff
path: root/src/include/access/tupmacs.h
diff options
context:
space:
mode:
authorNoah Misch <noah@leadboat.com>2013-10-20 21:04:52 -0400
committerNoah Misch <noah@leadboat.com>2013-10-20 21:04:52 -0400
commit709170b790c11b4012004a6baf11a0fc6ec950de (patch)
tree5194f18a7586d5612e3eb2b2cce06e4ecaf316ca /src/include/access/tupmacs.h
parent713a9f210d5cf5d94cc420b01eef5183569402e0 (diff)
downloadpostgresql-709170b790c11b4012004a6baf11a0fc6ec950de.tar.gz
Consistently use unsigned arithmetic for alignment calculations.
This avoids an assumption about the signed number representation. It is anticipated to have no functional changes on supported configurations; many two's complement assumptions remain elsewhere. Per a suggestion from Andres Freund.
Diffstat (limited to 'src/include/access/tupmacs.h')
-rw-r--r--src/include/access/tupmacs.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/include/access/tupmacs.h b/src/include/access/tupmacs.h
index 2886cedc1c..42a50e4604 100644
--- a/src/include/access/tupmacs.h
+++ b/src/include/access/tupmacs.h
@@ -101,7 +101,7 @@
#define att_align_datum(cur_offset, attalign, attlen, attdatum) \
( \
((attlen) == -1 && VARATT_IS_SHORT(DatumGetPointer(attdatum))) ? \
- (intptr_t) (cur_offset) : \
+ (uintptr_t) (cur_offset) : \
att_align_nominal(cur_offset, attalign) \
)
@@ -116,13 +116,13 @@
* aligned 4-byte length word; in either case we need not align.)
*
* Note: some callers pass a "char *" pointer for cur_offset. This is
- * a bit of a hack but should work all right as long as intptr_t is the
+ * a bit of a hack but should work all right as long as uintptr_t is the
* correct width.
*/
#define att_align_pointer(cur_offset, attalign, attlen, attptr) \
( \
((attlen) == -1 && VARATT_NOT_PAD_BYTE(attptr)) ? \
- (intptr_t) (cur_offset) : \
+ (uintptr_t) (cur_offset) : \
att_align_nominal(cur_offset, attalign) \
)
@@ -144,7 +144,7 @@
#define att_align_nominal(cur_offset, attalign) \
( \
((attalign) == 'i') ? INTALIGN(cur_offset) : \
- (((attalign) == 'c') ? (intptr_t) (cur_offset) : \
+ (((attalign) == 'c') ? (uintptr_t) (cur_offset) : \
(((attalign) == 'd') ? DOUBLEALIGN(cur_offset) : \
( \
AssertMacro((attalign) == 's'), \