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

Commit901be0f

Browse files
committed
Remove all the special-case code for INT64_IS_BUSTED, per decision that
we're not going to support that anymore.I did keep the 64-bit-CRC-with-32-bit-arithmetic code, since it has aperformance excuse to live. It's a bit moot since that's all ifdef'dout, of course.
1 parentc282b36 commit901be0f

File tree

16 files changed

+45
-203
lines changed

16 files changed

+45
-203
lines changed

‎contrib/btree_gin/btree_gin.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* $PostgreSQL: pgsql/contrib/btree_gin/btree_gin.c,v 1.3 2009/08/04 18:49:50 tgl Exp $
2+
* $PostgreSQL: pgsql/contrib/btree_gin/btree_gin.c,v 1.4 2010/01/07 04:53:34 tgl Exp $
33
*/
44
#include"postgres.h"
55

@@ -214,8 +214,7 @@ static Datum
214214
leftmostvalue_int8(void)
215215
{
216216
/*
217-
* Use sequence's definition to keep compatibility. Another way may make a
218-
* problem with INT64_IS_BUSTED
217+
* Use sequence's definition to keep compatibility.
219218
*/
220219
returnInt64GetDatum(SEQ_MINVALUE);
221220
}
@@ -245,8 +244,7 @@ static Datum
245244
leftmostvalue_money(void)
246245
{
247246
/*
248-
* Use sequence's definition to keep compatibility. Another way may make a
249-
* problem with INT64_IS_BUSTED
247+
* Use sequence's definition to keep compatibility.
250248
*/
251249
returnInt64GetDatum(SEQ_MINVALUE);
252250
}

‎src/backend/access/hash/hashfunc.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/access/hash/hashfunc.c,v 1.61 2010/01/02 16:57:34momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/access/hash/hashfunc.c,v 1.62 2010/01/07 04:53:34tgl Exp $
1212
*
1313
* NOTES
1414
* These functions are stored in pg_amproc.For each operator class
@@ -59,18 +59,13 @@ hashint8(PG_FUNCTION_ARGS)
5959
* value if the sign is positive, or the complement of the high half when
6060
* the sign is negative.
6161
*/
62-
#ifndefINT64_IS_BUSTED
6362
int64val=PG_GETARG_INT64(0);
6463
uint32lohalf= (uint32)val;
6564
uint32hihalf= (uint32) (val >>32);
6665

6766
lohalf ^= (val >=0) ?hihalf : ~hihalf;
6867

6968
returnhash_uint32(lohalf);
70-
#else
71-
/* here if we can't count on "x >> 32" to work sanely */
72-
returnhash_uint32((int32)PG_GETARG_INT64(0));
73-
#endif
7469
}
7570

7671
Datum

‎src/backend/libpq/pqformat.c

Lines changed: 1 addition & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
2525
* Portions Copyright (c) 1994, Regents of the University of California
2626
*
27-
*$PostgreSQL: pgsql/src/backend/libpq/pqformat.c,v 1.51 2010/01/02 16:57:45 momjian Exp $
27+
*$PostgreSQL: pgsql/src/backend/libpq/pqformat.c,v 1.52 2010/01/07 04:53:34 tgl Exp $
2828
*
2929
*-------------------------------------------------------------------------
3030
*/
@@ -272,12 +272,7 @@ pq_sendint64(StringInfo buf, int64 i)
272272
uint32n32;
273273

274274
/* High order half first, since we're doing MSB-first */
275-
#ifdefINT64_IS_BUSTED
276-
/* don't try a right shift of 32 on a 32-bit word */
277-
n32= (i<0) ?-1 :0;
278-
#else
279275
n32= (uint32) (i >>32);
280-
#endif
281276
n32=htonl(n32);
282277
appendBinaryStringInfo(buf, (char*)&n32,4);
283278

@@ -327,27 +322,6 @@ pq_sendfloat4(StringInfo buf, float4 f)
327322
void
328323
pq_sendfloat8(StringInfobuf,float8f)
329324
{
330-
#ifdefINT64_IS_BUSTED
331-
union
332-
{
333-
float8f;
334-
uint32h[2];
335-
}swap;
336-
337-
swap.f=f;
338-
swap.h[0]=htonl(swap.h[0]);
339-
swap.h[1]=htonl(swap.h[1]);
340-
341-
#ifdefWORDS_BIGENDIAN
342-
/* machine seems to be big-endian, send h[0] first */
343-
appendBinaryStringInfo(buf, (char*)&swap.h[0],4);
344-
appendBinaryStringInfo(buf, (char*)&swap.h[1],4);
345-
#else
346-
/* machine seems to be little-endian, send h[1] first */
347-
appendBinaryStringInfo(buf, (char*)&swap.h[1],4);
348-
appendBinaryStringInfo(buf, (char*)&swap.h[0],4);
349-
#endif
350-
#else/* INT64 works */
351325
union
352326
{
353327
float8f;
@@ -356,7 +330,6 @@ pq_sendfloat8(StringInfo buf, float8 f)
356330

357331
swap.f=f;
358332
pq_sendint64(buf,swap.i);
359-
#endif
360333
}
361334

362335
/* --------------------------------
@@ -520,18 +493,9 @@ pq_getmsgint64(StringInfo msg)
520493
h32=ntohl(h32);
521494
l32=ntohl(l32);
522495

523-
#ifdefINT64_IS_BUSTED
524-
/* error out if incoming value is wider than 32 bits */
525-
result=l32;
526-
if ((result<0) ? (h32!=-1) : (h32!=0))
527-
ereport(ERROR,
528-
(errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
529-
errmsg("binary value is out of range for type bigint")));
530-
#else
531496
result=h32;
532497
result <<=32;
533498
result |=l32;
534-
#endif
535499

536500
returnresult;
537501
}
@@ -564,24 +528,6 @@ pq_getmsgfloat4(StringInfo msg)
564528
float8
565529
pq_getmsgfloat8(StringInfomsg)
566530
{
567-
#ifdefINT64_IS_BUSTED
568-
union
569-
{
570-
float8f;
571-
uint32h[2];
572-
}swap;
573-
574-
#ifdefWORDS_BIGENDIAN
575-
/* machine seems to be big-endian, receive h[0] first */
576-
swap.h[0]=pq_getmsgint(msg,4);
577-
swap.h[1]=pq_getmsgint(msg,4);
578-
#else
579-
/* machine seems to be little-endian, receive h[1] first */
580-
swap.h[1]=pq_getmsgint(msg,4);
581-
swap.h[0]=pq_getmsgint(msg,4);
582-
#endif
583-
returnswap.f;
584-
#else/* INT64 works */
585531
union
586532
{
587533
float8f;
@@ -590,7 +536,6 @@ pq_getmsgfloat8(StringInfo msg)
590536

591537
swap.i=pq_getmsgint64(msg);
592538
returnswap.f;
593-
#endif
594539
}
595540

596541
/* --------------------------------

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

Lines changed: 2 additions & 8 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-
* $PostgreSQL: pgsql/src/backend/utils/adt/int8.c,v 1.76 2010/01/02 16:57:54 momjian Exp $
10+
* $PostgreSQL: pgsql/src/backend/utils/adt/int8.c,v 1.77 2010/01/07 04:53:34 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -76,15 +76,12 @@ scanint8(const char *str, bool errorOK, int64 *result)
7676
* Do an explicit check for INT64_MIN.Ugly though this is, it's
7777
* cleaner than trying to get the loop below to handle it portably.
7878
*/
79-
#ifndefINT64_IS_BUSTED
8079
if (strncmp(ptr,"9223372036854775808",19)==0)
8180
{
8281
tmp=-INT64CONST(0x7fffffffffffffff)-1;
8382
ptr+=19;
8483
gotogotdigits;
8584
}
86-
#endif
87-
8885
sign=-1;
8986
}
9087
elseif (*ptr=='+')
@@ -575,12 +572,9 @@ int8mul(PG_FUNCTION_ARGS)
575572
* Since the division is likely much more expensive than the actual
576573
* multiplication, we'd like to skip it where possible. The best bang for
577574
* the buck seems to be to check whether both inputs are in the int32
578-
* range; if so, no overflow is possible. (But that only works if we
579-
* really have a 64-bit int64 datatype...)
575+
* range; if so, no overflow is possible.
580576
*/
581-
#ifndefINT64_IS_BUSTED
582577
if (arg1!= (int64) ((int32)arg1)||arg2!= (int64) ((int32)arg2))
583-
#endif
584578
{
585579
if (arg2!=0&&
586580
(result /arg2!=arg1|| (arg2==-1&&arg1<0&&result<0)))

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

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* Copyright (c) 1998-2010, PostgreSQL Global Development Group
1515
*
1616
* IDENTIFICATION
17-
* $PostgreSQL: pgsql/src/backend/utils/adt/numeric.c,v 1.120 2010/01/02 16:57:54 momjian Exp $
17+
* $PostgreSQL: pgsql/src/backend/utils/adt/numeric.c,v 1.121 2010/01/07 04:53:34 tgl Exp $
1818
*
1919
*-------------------------------------------------------------------------
2020
*/
@@ -2808,16 +2808,8 @@ int8_sum(PG_FUNCTION_ARGS)
28082808

28092809
typedefstructInt8TransTypeData
28102810
{
2811-
#ifndefINT64_IS_BUSTED
28122811
int64count;
28132812
int64sum;
2814-
#else
2815-
/* "int64" isn't really 64 bits, so fake up properly-aligned fields */
2816-
int32count;
2817-
int32pad1;
2818-
int32sum;
2819-
int32pad2;
2820-
#endif
28212813
}Int8TransTypeData;
28222814

28232815
Datum

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

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*Author: Jan Wieck, Afilias USA INC.
1515
*64-bit txids: Marko Kreen, Skype Technologies
1616
*
17-
*$PostgreSQL: pgsql/src/backend/utils/adt/txid.c,v 1.10 2010/01/02 16:57:55 momjian Exp $
17+
*$PostgreSQL: pgsql/src/backend/utils/adt/txid.c,v 1.11 2010/01/07 04:53:34 tgl Exp $
1818
*
1919
*-------------------------------------------------------------------------
2020
*/
@@ -30,13 +30,8 @@
3030
#include"utils/snapmgr.h"
3131

3232

33-
#ifndefINT64_IS_BUSTED
3433
/* txid will be signed int8 in database, so must limit to 63 bits */
3534
#defineMAX_TXID UINT64CONST(0x7FFFFFFFFFFFFFFF)
36-
#else
37-
/* we only really have 32 bits to work with :-( */
38-
#defineMAX_TXID UINT64CONST(0x7FFFFFFF)
39-
#endif
4035

4136
/* Use unsigned variant internally */
4237
typedefuint64txid;
@@ -97,7 +92,6 @@ load_xid_epoch(TxidEpoch *state)
9792
statictxid
9893
convert_xid(TransactionIdxid,constTxidEpoch*state)
9994
{
100-
#ifndefINT64_IS_BUSTED
10195
uint64epoch;
10296

10397
/* return special xid's as-is */
@@ -114,10 +108,6 @@ convert_xid(TransactionId xid, const TxidEpoch *state)
114108
epoch++;
115109

116110
return (epoch <<32) |xid;
117-
#else/* INT64_IS_BUSTED */
118-
/* we can't do anything with the epoch, so ignore it */
119-
return (txid)xid&MAX_TXID;
120-
#endif/* INT64_IS_BUSTED */
121111
}
122112

123113
/*

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* Portions Copyright (c) 1994, Regents of the University of California
1010
*
1111
* IDENTIFICATION
12-
* $PostgreSQL: pgsql/src/backend/utils/adt/varbit.c,v 1.60 2010/01/02 16:57:55 momjian Exp $
12+
* $PostgreSQL: pgsql/src/backend/utils/adt/varbit.c,v 1.61 2010/01/07 04:53:34 tgl Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -1414,11 +1414,7 @@ bitfromint8(PG_FUNCTION_ARGS)
14141414

14151415
r=VARBITS(result);
14161416
destbitsleft=typmod;
1417-
#ifndefINT64_IS_BUSTED
14181417
srcbitsleft=64;
1419-
#else
1420-
srcbitsleft=32;/* don't try to shift more than 32 */
1421-
#endif
14221418
/* drop any input bits that don't fit */
14231419
srcbitsleft=Min(srcbitsleft,destbitsleft);
14241420
/* sign-fill any excess bytes in output */

‎src/backend/utils/fmgr/fmgr.c

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/utils/fmgr/fmgr.c,v 1.128 2010/01/02 16:57:56 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/utils/fmgr/fmgr.c,v 1.129 2010/01/07 04:53:34 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -2112,24 +2112,10 @@ fmgr(Oid procedureId,...)
21122112
Datum
21132113
Int64GetDatum(int64X)
21142114
{
2115-
#ifndefINT64_IS_BUSTED
21162115
int64*retval= (int64*)palloc(sizeof(int64));
21172116

21182117
*retval=X;
21192118
returnPointerGetDatum(retval);
2120-
#else/* INT64_IS_BUSTED */
2121-
2122-
/*
2123-
* On a machine with no 64-bit-int C datatype, sizeof(int64) will not be
2124-
* 8, but we want Int64GetDatum to return an 8-byte object anyway, with
2125-
* zeroes in the unused bits. This is needed so that, for example, hash
2126-
* join of int8 will behave properly.
2127-
*/
2128-
int64*retval= (int64*)palloc0(Max(sizeof(int64),8));
2129-
2130-
*retval=X;
2131-
returnPointerGetDatum(retval);
2132-
#endif/* INT64_IS_BUSTED */
21332119
}
21342120
#endif/* USE_FLOAT8_BYVAL */
21352121

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
*
2020
*
2121
* IDENTIFICATION
22-
* $PostgreSQL: pgsql/src/backend/utils/hash/pg_crc.c,v 1.22 2010/01/02 16:57:56 momjian Exp $
22+
* $PostgreSQL: pgsql/src/backend/utils/hash/pg_crc.c,v 1.23 2010/01/07 04:53:34 tgl Exp $
2323
*
2424
*-------------------------------------------------------------------------
2525
*/
@@ -115,7 +115,7 @@ const uint32 pg_crc32_table[256] = {
115115
* (ECMA-182, available from http://www.ecma.ch/ecma1/STAND/ECMA-182.HTM)
116116
*/
117117

118-
#ifdefINT64_IS_BUSTED
118+
#ifSIZEOF_VOID_P<8/* this test must match the one in pg_crc.h */
119119

120120
constuint32pg_crc64_table0[256]= {
121121
0x00000000,0xA9EA3693,
@@ -378,7 +378,8 @@ const uint32 pg_crc64_table1[256] = {
378378
0x5DEDC41A,0x1F1D25F1,
379379
0xD80C07CD,0x9AFCE626
380380
};
381-
#else/* int64 works */
381+
382+
#else/* use int64 implementation */
382383

383384
constuint64pg_crc64_table[256]= {
384385
UINT64CONST(0x0000000000000000),UINT64CONST(0x42F0E1EBA9EA3693),
@@ -510,6 +511,6 @@ const uint64 pg_crc64_table[256] = {
510511
UINT64CONST(0x5DEDC41A34BBEEB2),UINT64CONST(0x1F1D25F19D51D821),
511512
UINT64CONST(0xD80C07CD676F8394),UINT64CONST(0x9AFCE626CE85B507)
512513
};
513-
#endif/*INT64_IS_BUSTED */
514+
#endif/*SIZEOF_VOID_P < 8 */
514515

515516
#endif/* PROVIDE_64BIT_CRC */

‎src/backend/utils/misc/guc.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Written by Peter Eisentraut <peter_e@gmx.net>.
1111
*
1212
* IDENTIFICATION
13-
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.531 2010/01/02 16:57:58 momjian Exp $
13+
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.532 2010/01/07 04:53:35 tgl Exp $
1414
*
1515
*--------------------------------------------------------------------
1616
*/
@@ -4240,10 +4240,6 @@ parse_int(const char *value, int *result, int flags, const char **hintmsg)
42404240
/*
42414241
* Note: the multiple-switch coding technique here is a bit tedious,
42424242
* but seems necessary to avoid intermediate-value overflows.
4243-
*
4244-
* If INT64_IS_BUSTED (ie, it's really int32) we will fail to detect
4245-
* overflow due to units conversion, but there are few enough such
4246-
* machines that it does not seem worth trying to be smarter.
42474243
*/
42484244
if (flags&GUC_UNIT_MEMORY)
42494245
{
@@ -6627,10 +6623,7 @@ _ShowOption(struct config_generic * record, bool use_units)
66276623
{
66286624
/*
66296625
* Use int64 arithmetic to avoid overflows in units
6630-
* conversion.If INT64_IS_BUSTED we might overflow
6631-
* anyway and print bogus answers, but there are few
6632-
* enough such machines that it doesn't seem worth trying
6633-
* harder.
6626+
* conversion.
66346627
*/
66356628
int64result=*conf->variable;
66366629
constchar*unit;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp