1212 * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
1313 * Portions Copyright (c) 1994, Regents of the University of California
1414 *
15- * $PostgreSQL: pgsql/src/include/c.h,v 1.236 2009/06/11 14:49:08 momjian Exp $
15+ * $PostgreSQL: pgsql/src/include/c.h,v 1.237 2009/12/31 19:41:35 tgl Exp $
1616 *
1717 *-------------------------------------------------------------------------
1818 */
7272#ifdef HAVE_STRINGS_H
7373#include <strings.h>
7474#endif
75+ #ifdef HAVE_STDINT_H
76+ #include <stdint.h>
77+ #endif
7578#include <sys/types.h>
7679
7780#include <errno.h>
@@ -492,7 +495,7 @@ typedef NameData *Name;
492495 * True iff pointer is properly aligned to point to the given type.
493496 */
494497#define PointerIsAligned (pointer , type ) \
495- (((long )(pointer) % (sizeof (type))) == 0)
498+ (((intptr_t )(pointer) % (sizeof (type))) == 0)
496499
497500#define OidIsValid (objectId ) ((bool) ((objectId) != InvalidOid))
498501
@@ -538,7 +541,7 @@ typedef NameData *Name;
538541 */
539542
540543#define TYPEALIGN (ALIGNVAL ,LEN ) \
541- (((long ) (LEN) + ((ALIGNVAL) - 1)) & ~((long ) ((ALIGNVAL) - 1)))
544+ (((intptr_t ) (LEN) + ((ALIGNVAL) - 1)) & ~((intptr_t ) ((ALIGNVAL) - 1)))
542545
543546#define SHORTALIGN (LEN ) TYPEALIGN(ALIGNOF_SHORT, (LEN))
544547#define INTALIGN (LEN ) TYPEALIGN(ALIGNOF_INT, (LEN))
@@ -549,7 +552,7 @@ typedef NameData *Name;
549552#define BUFFERALIGN (LEN ) TYPEALIGN(ALIGNOF_BUFFER, (LEN))
550553
551554#define TYPEALIGN_DOWN (ALIGNVAL ,LEN ) \
552- (((long ) (LEN)) & ~((long ) ((ALIGNVAL) - 1)))
555+ (((intptr_t ) (LEN)) & ~((intptr_t ) ((ALIGNVAL) - 1)))
553556
554557#define SHORTALIGN_DOWN (LEN ) TYPEALIGN_DOWN(ALIGNOF_SHORT, (LEN))
555558#define INTALIGN_DOWN (LEN ) TYPEALIGN_DOWN(ALIGNOF_INT, (LEN))
@@ -630,7 +633,7 @@ typedef NameData *Name;
630633 int _val = (val ); \
631634 Size _len = (len ); \
632635\
633- if ((((long ) _vstart ) & LONG_ALIGN_MASK ) == 0 && \
636+ if ((((intptr_t ) _vstart ) & LONG_ALIGN_MASK ) == 0 && \
634637 (_len & LONG_ALIGN_MASK ) == 0 && \
635638 _val == 0 && \
636639 _len <= MEMSET_LOOP_LIMIT && \
0 commit comments