summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorTom Lane2001-03-23 18:42:12 +0000
committerTom Lane2001-03-23 18:42:12 +0000
commite458ebfd21374588bee185ba0fc2e5eba03da134 (patch)
tree510ff7db605da858ddb7c735790655a45c738a1a /src/include
parent32924c1c9048a4dbd99f2cfedbd3128b50968c14 (diff)
When using 'long long int' for int64 type, check to see if the compiler
accepts nnnLL syntax for long long constants. If so, decorate the CRC64 constants with LL to avoid warnings and/or erroneous results from certain non-standards-compliant compilers.
Diffstat (limited to 'src/include')
-rw-r--r--src/include/config.h.in5
-rw-r--r--src/include/utils/pg_crc.h13
2 files changed, 14 insertions, 4 deletions
diff --git a/src/include/config.h.in b/src/include/config.h.in
index aba0daafd88..a4c1752ea1f 100644
--- a/src/include/config.h.in
+++ b/src/include/config.h.in
@@ -8,7 +8,7 @@
* or in config.h afterwards. Of course, if you edit config.h, then your
* changes will be overwritten the next time you run configure.
*
- * $Id: config.h.in,v 1.160 2001/03/01 05:05:29 ishii Exp $
+ * $Id: config.h.in,v 1.161 2001/03/23 18:42:12 tgl Exp $
*/
#ifndef CONFIG_H
@@ -591,6 +591,9 @@ extern int fdatasync(int fildes);
/* Set to 1 if type "long long int" works and is 64 bits */
#undef HAVE_LONG_LONG_INT_64
+/* Set to 1 if type "long long int" constants should be suffixed by LL */
+#undef HAVE_LL_CONSTANTS
+
/* Define this as the appropriate snprintf format for 64-bit ints, if any */
#undef INT64_FORMAT
diff --git a/src/include/utils/pg_crc.h b/src/include/utils/pg_crc.h
index ad67e3b1c94..675859beed0 100644
--- a/src/include/utils/pg_crc.h
+++ b/src/include/utils/pg_crc.h
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: pg_crc.h,v 1.2 2001/03/22 04:01:14 momjian Exp $
+ * $Id: pg_crc.h,v 1.3 2001/03/23 18:42:12 tgl Exp $
*/
#ifndef PG_CRC_H
#define PG_CRC_H
@@ -78,16 +78,23 @@ extern const uint32 crc_table1[];
#else /* int64 works */
+/* decide if we need to decorate constants */
+#ifdef HAVE_LL_CONSTANTS
+#define INT64CONST(x) x##LL
+#else
+#define INT64CONST(x) x
+#endif
+
typedef struct crc64
{
uint64 crc0;
} crc64;
/* Initialize a CRC accumulator */
-#define INIT_CRC64(crc) ((crc).crc0 = (uint64) 0xffffffffffffffff)
+#define INIT_CRC64(crc) ((crc).crc0 = INT64CONST(0xffffffffffffffff))
/* Finish a CRC calculation */
-#define FIN_CRC64(crc) ((crc).crc0 ^= (uint64) 0xffffffffffffffff)
+#define FIN_CRC64(crc) ((crc).crc0 ^= INT64CONST(0xffffffffffffffff))
/* Accumulate some (more) bytes into a CRC */
#define COMP_CRC64(crc, data, len) \