mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
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 a performance excuse to live. It's a bit moot since that's all ifdef'd out, of course.
This commit is contained in:
@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/int8.c,v 1.76 2010/01/02 16:57:54 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/int8.c,v 1.77 2010/01/07 04:53:34 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -76,15 +76,12 @@ scanint8(const char *str, bool errorOK, int64 *result)
|
||||
* Do an explicit check for INT64_MIN. Ugly though this is, it's
|
||||
* cleaner than trying to get the loop below to handle it portably.
|
||||
*/
|
||||
#ifndef INT64_IS_BUSTED
|
||||
if (strncmp(ptr, "9223372036854775808", 19) == 0)
|
||||
{
|
||||
tmp = -INT64CONST(0x7fffffffffffffff) - 1;
|
||||
ptr += 19;
|
||||
goto gotdigits;
|
||||
}
|
||||
#endif
|
||||
|
||||
sign = -1;
|
||||
}
|
||||
else if (*ptr == '+')
|
||||
@ -575,12 +572,9 @@ int8mul(PG_FUNCTION_ARGS)
|
||||
* Since the division is likely much more expensive than the actual
|
||||
* multiplication, we'd like to skip it where possible. The best bang for
|
||||
* the buck seems to be to check whether both inputs are in the int32
|
||||
* range; if so, no overflow is possible. (But that only works if we
|
||||
* really have a 64-bit int64 datatype...)
|
||||
* range; if so, no overflow is possible.
|
||||
*/
|
||||
#ifndef INT64_IS_BUSTED
|
||||
if (arg1 != (int64) ((int32) arg1) || arg2 != (int64) ((int32) arg2))
|
||||
#endif
|
||||
{
|
||||
if (arg2 != 0 &&
|
||||
(result / arg2 != arg1 || (arg2 == -1 && arg1 < 0 && result < 0)))
|
||||
|
@ -14,7 +14,7 @@
|
||||
* Copyright (c) 1998-2010, PostgreSQL Global Development Group
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/numeric.c,v 1.120 2010/01/02 16:57:54 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/numeric.c,v 1.121 2010/01/07 04:53:34 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -2808,16 +2808,8 @@ int8_sum(PG_FUNCTION_ARGS)
|
||||
|
||||
typedef struct Int8TransTypeData
|
||||
{
|
||||
#ifndef INT64_IS_BUSTED
|
||||
int64 count;
|
||||
int64 sum;
|
||||
#else
|
||||
/* "int64" isn't really 64 bits, so fake up properly-aligned fields */
|
||||
int32 count;
|
||||
int32 pad1;
|
||||
int32 sum;
|
||||
int32 pad2;
|
||||
#endif
|
||||
} Int8TransTypeData;
|
||||
|
||||
Datum
|
||||
|
@ -14,7 +14,7 @@
|
||||
* Author: Jan Wieck, Afilias USA INC.
|
||||
* 64-bit txids: Marko Kreen, Skype Technologies
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/txid.c,v 1.10 2010/01/02 16:57:55 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/txid.c,v 1.11 2010/01/07 04:53:34 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -30,13 +30,8 @@
|
||||
#include "utils/snapmgr.h"
|
||||
|
||||
|
||||
#ifndef INT64_IS_BUSTED
|
||||
/* txid will be signed int8 in database, so must limit to 63 bits */
|
||||
#define MAX_TXID UINT64CONST(0x7FFFFFFFFFFFFFFF)
|
||||
#else
|
||||
/* we only really have 32 bits to work with :-( */
|
||||
#define MAX_TXID UINT64CONST(0x7FFFFFFF)
|
||||
#endif
|
||||
|
||||
/* Use unsigned variant internally */
|
||||
typedef uint64 txid;
|
||||
@ -97,7 +92,6 @@ load_xid_epoch(TxidEpoch *state)
|
||||
static txid
|
||||
convert_xid(TransactionId xid, const TxidEpoch *state)
|
||||
{
|
||||
#ifndef INT64_IS_BUSTED
|
||||
uint64 epoch;
|
||||
|
||||
/* return special xid's as-is */
|
||||
@ -114,10 +108,6 @@ convert_xid(TransactionId xid, const TxidEpoch *state)
|
||||
epoch++;
|
||||
|
||||
return (epoch << 32) | xid;
|
||||
#else /* INT64_IS_BUSTED */
|
||||
/* we can't do anything with the epoch, so ignore it */
|
||||
return (txid) xid & MAX_TXID;
|
||||
#endif /* INT64_IS_BUSTED */
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -9,7 +9,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/varbit.c,v 1.60 2010/01/02 16:57:55 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/varbit.c,v 1.61 2010/01/07 04:53:34 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -1414,11 +1414,7 @@ bitfromint8(PG_FUNCTION_ARGS)
|
||||
|
||||
r = VARBITS(result);
|
||||
destbitsleft = typmod;
|
||||
#ifndef INT64_IS_BUSTED
|
||||
srcbitsleft = 64;
|
||||
#else
|
||||
srcbitsleft = 32; /* don't try to shift more than 32 */
|
||||
#endif
|
||||
/* drop any input bits that don't fit */
|
||||
srcbitsleft = Min(srcbitsleft, destbitsleft);
|
||||
/* sign-fill any excess bytes in output */
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/fmgr/fmgr.c,v 1.128 2010/01/02 16:57:56 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/fmgr/fmgr.c,v 1.129 2010/01/07 04:53:34 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -2112,24 +2112,10 @@ fmgr(Oid procedureId,...)
|
||||
Datum
|
||||
Int64GetDatum(int64 X)
|
||||
{
|
||||
#ifndef INT64_IS_BUSTED
|
||||
int64 *retval = (int64 *) palloc(sizeof(int64));
|
||||
|
||||
*retval = X;
|
||||
return PointerGetDatum(retval);
|
||||
#else /* INT64_IS_BUSTED */
|
||||
|
||||
/*
|
||||
* On a machine with no 64-bit-int C datatype, sizeof(int64) will not be
|
||||
* 8, but we want Int64GetDatum to return an 8-byte object anyway, with
|
||||
* zeroes in the unused bits. This is needed so that, for example, hash
|
||||
* join of int8 will behave properly.
|
||||
*/
|
||||
int64 *retval = (int64 *) palloc0(Max(sizeof(int64), 8));
|
||||
|
||||
*retval = X;
|
||||
return PointerGetDatum(retval);
|
||||
#endif /* INT64_IS_BUSTED */
|
||||
}
|
||||
#endif /* USE_FLOAT8_BYVAL */
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/hash/pg_crc.c,v 1.22 2010/01/02 16:57:56 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/hash/pg_crc.c,v 1.23 2010/01/07 04:53:34 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -115,7 +115,7 @@ const uint32 pg_crc32_table[256] = {
|
||||
* (ECMA-182, available from http://www.ecma.ch/ecma1/STAND/ECMA-182.HTM)
|
||||
*/
|
||||
|
||||
#ifdef INT64_IS_BUSTED
|
||||
#if SIZEOF_VOID_P < 8 /* this test must match the one in pg_crc.h */
|
||||
|
||||
const uint32 pg_crc64_table0[256] = {
|
||||
0x00000000, 0xA9EA3693,
|
||||
@ -378,7 +378,8 @@ const uint32 pg_crc64_table1[256] = {
|
||||
0x5DEDC41A, 0x1F1D25F1,
|
||||
0xD80C07CD, 0x9AFCE626
|
||||
};
|
||||
#else /* int64 works */
|
||||
|
||||
#else /* use int64 implementation */
|
||||
|
||||
const uint64 pg_crc64_table[256] = {
|
||||
UINT64CONST(0x0000000000000000), UINT64CONST(0x42F0E1EBA9EA3693),
|
||||
@ -510,6 +511,6 @@ const uint64 pg_crc64_table[256] = {
|
||||
UINT64CONST(0x5DEDC41A34BBEEB2), UINT64CONST(0x1F1D25F19D51D821),
|
||||
UINT64CONST(0xD80C07CD676F8394), UINT64CONST(0x9AFCE626CE85B507)
|
||||
};
|
||||
#endif /* INT64_IS_BUSTED */
|
||||
#endif /* SIZEOF_VOID_P < 8 */
|
||||
|
||||
#endif /* PROVIDE_64BIT_CRC */
|
||||
|
@ -10,7 +10,7 @@
|
||||
* Written by Peter Eisentraut <peter_e@gmx.net>.
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.531 2010/01/02 16:57:58 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.532 2010/01/07 04:53:35 tgl Exp $
|
||||
*
|
||||
*--------------------------------------------------------------------
|
||||
*/
|
||||
@ -4240,10 +4240,6 @@ parse_int(const char *value, int *result, int flags, const char **hintmsg)
|
||||
/*
|
||||
* Note: the multiple-switch coding technique here is a bit tedious,
|
||||
* but seems necessary to avoid intermediate-value overflows.
|
||||
*
|
||||
* If INT64_IS_BUSTED (ie, it's really int32) we will fail to detect
|
||||
* overflow due to units conversion, but there are few enough such
|
||||
* machines that it does not seem worth trying to be smarter.
|
||||
*/
|
||||
if (flags & GUC_UNIT_MEMORY)
|
||||
{
|
||||
@ -6627,10 +6623,7 @@ _ShowOption(struct config_generic * record, bool use_units)
|
||||
{
|
||||
/*
|
||||
* Use int64 arithmetic to avoid overflows in units
|
||||
* conversion. If INT64_IS_BUSTED we might overflow
|
||||
* anyway and print bogus answers, but there are few
|
||||
* enough such machines that it doesn't seem worth trying
|
||||
* harder.
|
||||
* conversion.
|
||||
*/
|
||||
int64 result = *conf->variable;
|
||||
const char *unit;
|
||||
|
Reference in New Issue
Block a user