Bugzilla Bug 277704: define the LL_MAXINT, LL_MININT, ... macros as
authorwtchang%redhat.com
Wed, 12 Jan 2005 02:47:56 +0000
changeset 3246 42c3ea8ff3a2da329eba21018f30da7afec2a853
parent 3243 fb9a0f04c6c41992c5ff675e2659f9614fa6d973
child 3248 272921185f57b4699be8424d2dad15a3a4d8a128
push idunknown
push userunknown
push dateunknown
bugs277704
Bugzilla Bug 277704: define the LL_MAXINT, LL_MININT, ... macros as constants rather than functions on platforms that have a 64-bit integer type. The patch is contributed by Christian Biesinger <cbiesinger@gmx.at>. r=wtc.
pr/include/prlong.h
--- a/pr/include/prlong.h
+++ b/pr/include/prlong.h
@@ -70,28 +70,35 @@ PRUint64 __pascal __loadds __export
     LL_MaxUint(void);
 #else
 NSPR_API(PRInt64) LL_MaxInt(void);
 NSPR_API(PRInt64) LL_MinInt(void);
 NSPR_API(PRInt64) LL_Zero(void);
 NSPR_API(PRUint64) LL_MaxUint(void);
 #endif
 
-#define LL_MAXINT   LL_MaxInt()
-#define LL_MININT   LL_MinInt()
-#define LL_ZERO     LL_Zero()
-#define LL_MAXUINT  LL_MaxUint()
-
 #if defined(HAVE_LONG_LONG)
 
 #if PR_BYTES_PER_LONG == 8
+#define LL_MAXINT   9223372036854775807L
+#define LL_MININT   (-LL_MAXINT - 1L)
+#define LL_ZERO     0L
+#define LL_MAXUINT  18446744073709551615UL
 #define LL_INIT(hi, lo)  ((hi ## L << 32) + lo ## L)
 #elif (defined(WIN32) || defined(WIN16)) && !defined(__GNUC__)
+#define LL_MAXINT   9223372036854775807i64
+#define LL_MININT   (-LL_MAXINT - 1i64)
+#define LL_ZERO     0i64
+#define LL_MAXUINT  18446744073709551615ui64
 #define LL_INIT(hi, lo)  ((hi ## i64 << 32) + lo ## i64)
 #else
+#define LL_MAXINT   9223372036854775807LL
+#define LL_MININT   (-LL_MAXINT - 1LL)
+#define LL_ZERO     0LL
+#define LL_MAXUINT  18446744073709551615ULL
 #define LL_INIT(hi, lo)  ((hi ## LL << 32) + lo ## LL)
 #endif
 
 /***********************************************************************
 ** MACROS:      LL_*
 ** DESCRIPTION:
 **      The following macros define portable access to the 64 bit
 **      math facilities.
@@ -196,16 +203,21 @@ NSPR_API(PRUint64) LL_MaxUint(void);
 **              PRUint64 *rp: pointer to remainder
 ***********************************************************************/
 #define LL_UDIVMOD(qp, rp, a, b) \
     (*(qp) = ((PRUint64)(a) / (b)), \
      *(rp) = ((PRUint64)(a) % (b)))
 
 #else  /* !HAVE_LONG_LONG */
 
+#define LL_MAXINT   LL_MaxInt()
+#define LL_MININT   LL_MinInt()
+#define LL_ZERO     LL_Zero()
+#define LL_MAXUINT  LL_MaxUint()
+
 #ifdef IS_LITTLE_ENDIAN
 #define LL_INIT(hi, lo) {PR_UINT32(lo), PR_UINT32(hi)}
 #else
 #define LL_INIT(hi, lo) {PR_UINT32(hi), PR_UINT32(lo)}
 #endif
 
 #define LL_IS_ZERO(a)        (((a).hi == 0) && ((a).lo == 0))
 #define LL_EQ(a, b)        (((a).hi == (b).hi) && ((a).lo == (b).lo))