From 7ebbf20763281ebd4d9c83063ec37181b575c42a Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Wed, 14 Mar 2001 20:12:10 +0000 Subject: [PATCH] Remove obsolete PowerPC-specific hack for comparisons to DBL_MIN (per recent discussion with Tatsuo). Hopefully the compilers with that old bug are all long gone. --- src/backend/utils/adt/datetime.c | 35 +------------------------------- src/include/utils/timestamp.h | 30 ++++++++------------------- 2 files changed, 10 insertions(+), 55 deletions(-) diff --git a/src/backend/utils/adt/datetime.c b/src/backend/utils/adt/datetime.c index 3a9178da5b..8e9299643f 100644 --- a/src/backend/utils/adt/datetime.c +++ b/src/backend/utils/adt/datetime.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/adt/datetime.c,v 1.60 2001/01/24 19:43:13 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/datetime.c,v 1.61 2001/03/14 20:12:10 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -2397,36 +2397,3 @@ EncodeTimeSpan(struct tm * tm, double fsec, int style, char *str) return 0; } /* EncodeTimeSpan() */ - - -#if defined(linux) && defined(__powerpc__) - -int -timestamp_is_epoch(double j) -{ - static union - { - double epoch; - unsigned char c[8]; - } u; - - u.c[0] = 0x80; /* sign bit */ - u.c[1] = 0x10; /* DBL_MIN */ - - return j == u.epoch; -} -int -timestamp_is_current(double j) -{ - static union - { - double current; - unsigned char c[8]; - } u; - - u.c[1] = 0x10; /* DBL_MIN */ - - return j == u.current; -} - -#endif diff --git a/src/include/utils/timestamp.h b/src/include/utils/timestamp.h index 7a5422327c..5f74d55750 100644 --- a/src/include/utils/timestamp.h +++ b/src/include/utils/timestamp.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: timestamp.h,v 1.14 2001/01/24 19:43:29 momjian Exp $ + * $Id: timestamp.h,v 1.15 2001/03/14 20:12:10 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -74,36 +74,24 @@ typedef struct #define DT_CURRENT (DBL_MIN) #define DT_EPOCH (-DBL_MIN) -#define TIMESTAMP_INVALID(j) do {j = DT_INVALID;} while (0) +#define TIMESTAMP_INVALID(j) do {j = DT_INVALID;} while (0) #ifdef NAN #define TIMESTAMP_IS_INVALID(j) (isnan(j)) #else -#define TIMESTAMP_IS_INVALID(j) (j == DT_INVALID) +#define TIMESTAMP_IS_INVALID(j) ((j) == DT_INVALID) #endif -#define TIMESTAMP_NOBEGIN(j) do {j = DT_NOBEGIN;} while (0) -#define TIMESTAMP_IS_NOBEGIN(j) (j == DT_NOBEGIN) +#define TIMESTAMP_NOBEGIN(j) do {j = DT_NOBEGIN;} while (0) +#define TIMESTAMP_IS_NOBEGIN(j) ((j) == DT_NOBEGIN) #define TIMESTAMP_NOEND(j) do {j = DT_NOEND;} while (0) -#define TIMESTAMP_IS_NOEND(j) (j == DT_NOEND) +#define TIMESTAMP_IS_NOEND(j) ((j) == DT_NOEND) -#define TIMESTAMP_CURRENT(j) do {j = DT_CURRENT;} while (0) -#if defined(linux) && defined(__powerpc__) -extern int timestamp_is_current(double j); - -#define TIMESTAMP_IS_CURRENT(j) timestamp_is_current(j) -#else -#define TIMESTAMP_IS_CURRENT(j) (j == DT_CURRENT) -#endif +#define TIMESTAMP_CURRENT(j) do {j = DT_CURRENT;} while (0) +#define TIMESTAMP_IS_CURRENT(j) ((j) == DT_CURRENT) #define TIMESTAMP_EPOCH(j) do {j = DT_EPOCH;} while (0) -#if defined(linux) && defined(__powerpc__) -extern int timestamp_is_epoch(double j); - -#define TIMESTAMP_IS_EPOCH(j) timestamp_is_epoch(j) -#else -#define TIMESTAMP_IS_EPOCH(j) (j == DT_EPOCH) -#endif +#define TIMESTAMP_IS_EPOCH(j) ((j) == DT_EPOCH) #define TIMESTAMP_IS_RELATIVE(j) (TIMESTAMP_IS_CURRENT(j) || TIMESTAMP_IS_EPOCH(j)) #define TIMESTAMP_NOT_FINITE(j) (TIMESTAMP_IS_INVALID(j) \ -- GitLab