Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit28a898a

Browse files
committed
Clean up INT64CONST conflicts. Make the pg_crc code use a macro called
UINT64CONST, since unsigned was what it wanted anyway. Centralize macrodefinitions into c.h.
1 parentbf1f2e5 commit28a898a

File tree

7 files changed

+161
-170
lines changed

7 files changed

+161
-170
lines changed

‎src/backend/utils/adt/int8.c

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/int8.c,v 1.38 2002/04/21 19:48:12 thomas Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/int8.c,v 1.39 2002/04/23 15:45:30 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -21,17 +21,6 @@
2121

2222
#include"utils/int8.h"
2323

24-
/* this should be set in pg_config.h, but just in case it wasn't: */
25-
#ifndefINT64_FORMAT
26-
#warning "Broken pg_config.h should have defined INT64_FORMAT"
27-
#defineINT64_FORMAT "%ld"
28-
#endif
29-
30-
#ifdefHAVE_LL_CONSTANTS
31-
#defineINT64CONST(x) ((int64) x##LL)
32-
#else
33-
#defineINT64CONST(x) ((int64) x)
34-
#endif
3524

3625
#defineMAXINT8LEN25
3726

‎src/backend/utils/hash/pg_crc.c

Lines changed: 129 additions & 129 deletions
Large diffs are not rendered by default.

‎src/include/c.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
1313
* Portions Copyright (c) 1994, Regents of the University of California
1414
*
15-
* $Id: c.h,v 1.116 2002/04/21 19:48:18 thomas Exp $
15+
* $Id: c.h,v 1.117 2002/04/23 15:45:30 tgl Exp $
1616
*
1717
*-------------------------------------------------------------------------
1818
*/
@@ -302,6 +302,17 @@ typedef unsigned long int uint64;
302302

303303
#endif/* not HAVE_LONG_INT_64 and not HAVE_LONG_LONG_INT_64 */
304304

305+
/* Decide if we need to decorate 64-bit constants */
306+
#ifdefHAVE_LL_CONSTANTS
307+
#defineINT64CONST(x) ((int64) x##LL)
308+
#defineUINT64CONST(x) ((uint64) x##LL)
309+
#else
310+
#defineINT64CONST(x) ((int64) x)
311+
#defineUINT64CONST(x) ((uint64) x)
312+
#endif
313+
314+
315+
/* Select timestamp representation (float8 or int64) */
305316
#if defined(USE_INTEGER_DATETIMES)&& !defined(INT64_IS_BUSTED)
306317
#defineHAVE_INT64_TIMESTAMP
307318
#endif

‎src/include/utils/date.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,13 @@
77
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $Id: date.h,v 1.18 2002/04/21 19:48:31 thomas Exp $
10+
* $Id: date.h,v 1.19 2002/04/23 15:45:30 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
1414
#ifndefDATE_H
1515
#defineDATE_H
1616

17-
#include"c.h"
1817
#include"fmgr.h"
1918

2019

‎src/include/utils/int8.h

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $Id: int8.h,v 1.32 2002/04/21 19:48:31 thomas Exp $
10+
* $Id: int8.h,v 1.33 2002/04/23 15:45:30 tgl Exp $
1111
*
1212
* NOTES
1313
* These data types are supported on all 64-bit architectures, and may
@@ -20,21 +20,15 @@
2020
#ifndefINT8_H
2121
#defineINT8_H
2222

23-
#include"c.h"
2423
#include"fmgr.h"
2524

25+
2626
/* this should be set in pg_config.h, but just in case it wasn't: */
2727
#ifndefINT64_FORMAT
2828
#warning "Broken pg_config.h should have defined INT64_FORMAT"
2929
#defineINT64_FORMAT "%ld"
3030
#endif
3131

32-
#ifdefHAVE_LL_CONSTANTS
33-
#defineINT64CONST(x) ((int64) x##LL)
34-
#else
35-
#defineINT64CONST(x) ((int64) x)
36-
#endif
37-
3832
externDatumint8in(PG_FUNCTION_ARGS);
3933
externDatumint8out(PG_FUNCTION_ARGS);
4034

‎src/include/utils/pg_crc.h

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Id: pg_crc.h,v 1.6 2001/11/05 17:46:36 momjian Exp $
9+
* $Id: pg_crc.h,v 1.7 2002/04/23 15:45:30 tgl Exp $
1010
*/
1111
#ifndefPG_CRC_H
1212
#definePG_CRC_H
@@ -78,23 +78,16 @@ extern const uint32 crc_table1[];
7878

7979
#else/* int64 works */
8080

81-
/* decide if we need to decorate constants */
82-
#ifdefHAVE_LL_CONSTANTS
83-
#defineINT64CONST(x) x##LL
84-
#else
85-
#defineINT64CONST(x) x
86-
#endif
87-
8881
typedefstructcrc64
8982
{
9083
uint64crc0;
9184
}crc64;
9285

9386
/* Initialize a CRC accumulator */
94-
#defineINIT_CRC64(crc) ((crc).crc0 =INT64CONST(0xffffffffffffffff))
87+
#defineINIT_CRC64(crc) ((crc).crc0 =UINT64CONST(0xffffffffffffffff))
9588

9689
/* Finish a CRC calculation */
97-
#defineFIN_CRC64(crc)((crc).crc0 ^=INT64CONST(0xffffffffffffffff))
90+
#defineFIN_CRC64(crc)((crc).crc0 ^=UINT64CONST(0xffffffffffffffff))
9891

9992
/* Accumulate some (more) bytes into a CRC */
10093
#defineCOMP_CRC64(crc,data,len)\

‎src/include/utils/timestamp.h

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Id: timestamp.h,v 1.25 2002/04/21 19:48:31 thomas Exp $
9+
* $Id: timestamp.h,v 1.26 2002/04/23 15:45:30 tgl Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -18,7 +18,6 @@
1818
#include<limits.h>
1919
#include<float.h>
2020

21-
#include"c.h"
2221
#include"fmgr.h"
2322
#ifdefHAVE_INT64_TIMESTAMP
2423
#include"utils/int8.h"
@@ -31,7 +30,7 @@
3130
*relative to an absolute time.
3231
*
3332
* Note that Postgres uses "time interval" to mean a bounded interval,
34-
*consisting of a beginning and ending time, not a time span - thomas 97/03/20
33+
*consisting of a beginning and ending time, not a time span - thomas 97/03/20
3534
*/
3635

3736
#ifdefHAVE_INT64_TIMESTAMP
@@ -56,10 +55,12 @@ typedef struct
5655
/*
5756
* Macros for fmgr-callable functions.
5857
*
59-
* For Timestamp, we make use of the same support routines as for float8.
60-
* Therefore Timestamp is pass-by-reference if and only if float8 is!
58+
* For Timestamp, we make use of the same support routines as for int64
59+
* or float8. Therefore Timestamp is pass-by-reference if and only if
60+
* int64 or float8 is!
6161
*/
6262
#ifdefHAVE_INT64_TIMESTAMP
63+
6364
#defineDatumGetTimestamp(X) ((Timestamp) DatumGetInt64(X))
6465
#defineDatumGetTimestampTz(X)((TimestampTz) DatumGetInt64(X))
6566
#defineDatumGetIntervalP(X) ((Interval *) DatumGetPointer(X))
@@ -80,6 +81,7 @@ typedef struct
8081
#defineDT_NOEND(INT64CONST(0x7fffffffffffffff))
8182

8283
#else
84+
8385
#defineDatumGetTimestamp(X) ((Timestamp) DatumGetFloat8(X))
8486
#defineDatumGetTimestampTz(X)((TimestampTz) DatumGetFloat8(X))
8587
#defineDatumGetIntervalP(X) ((Interval *) DatumGetPointer(X))
@@ -103,7 +105,9 @@ typedef struct
103105
#defineDT_NOBEGIN(-DBL_MAX)
104106
#defineDT_NOEND(DBL_MAX)
105107
#endif
106-
#endif
108+
109+
#endif/* HAVE_INT64_TIMESTAMP */
110+
107111

108112
#defineTIMESTAMP_NOBEGIN(j)do {j = DT_NOBEGIN;} while (0)
109113
#defineTIMESTAMP_IS_NOBEGIN(j) ((j) == DT_NOBEGIN)
@@ -118,15 +122,16 @@ typedef struct
118122
#defineMAX_INTERVAL_PRECISION 6
119123

120124
#ifdefHAVE_INT64_TIMESTAMP
125+
121126
typedefint32fsec_t;
122127

123-
#defineSECONDS_TO_TIMESTAMP(x) (INT64CONST(x000000))
124128
#else
129+
125130
typedefdoublefsec_t;
126131

127-
#defineSECONDS_TO_TIMESTAMP(x) (xe0)
128132
#defineTIME_PREC_INV 1000000.0
129133
#defineJROUND(j) (rint(((double) (j))*TIME_PREC_INV)/TIME_PREC_INV)
134+
130135
#endif
131136

132137

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp