head 1.5; access; symbols pkgsrc-2013Q2:1.5.0.32 pkgsrc-2013Q2-base:1.5 pkgsrc-2012Q4:1.5.0.30 pkgsrc-2012Q4-base:1.5 pkgsrc-2011Q4:1.5.0.28 pkgsrc-2011Q4-base:1.5 pkgsrc-2011Q2:1.5.0.26 pkgsrc-2011Q2-base:1.5 pkgsrc-2009Q4:1.5.0.24 pkgsrc-2009Q4-base:1.5 pkgsrc-2008Q4:1.5.0.22 pkgsrc-2008Q4-base:1.5 pkgsrc-2008Q3:1.5.0.20 pkgsrc-2008Q3-base:1.5 cube-native-xorg:1.5.0.18 cube-native-xorg-base:1.5 pkgsrc-2008Q2:1.5.0.16 pkgsrc-2008Q2-base:1.5 pkgsrc-2008Q1:1.5.0.14 pkgsrc-2008Q1-base:1.5 pkgsrc-2007Q4:1.5.0.12 pkgsrc-2007Q4-base:1.5 pkgsrc-2007Q3:1.5.0.10 pkgsrc-2007Q3-base:1.5 pkgsrc-2007Q2:1.5.0.8 pkgsrc-2007Q2-base:1.5 pkgsrc-2007Q1:1.5.0.6 pkgsrc-2007Q1-base:1.5 pkgsrc-2006Q4:1.5.0.4 pkgsrc-2006Q4-base:1.5 pkgsrc-2006Q3:1.5.0.2 pkgsrc-2006Q3-base:1.5 pkgsrc-2006Q2:1.4.0.6 pkgsrc-2006Q2-base:1.4 pkgsrc-2006Q1:1.4.0.4 pkgsrc-2006Q1-base:1.4 pkgsrc-2005Q4:1.4.0.2 pkgsrc-2005Q4-base:1.4 pkgsrc-2005Q3:1.3.0.2 pkgsrc-2005Q3-base:1.3 pkgsrc-2005Q2:1.2.0.2 pkgsrc-2005Q2-base:1.2; locks; strict; comment @# @; 1.5 date 2006.09.24.16.46.29; author salo; state dead; branches; next 1.4; 1.4 date 2005.09.28.12.04.29; author rillig; state Exp; branches; next 1.3; 1.3 date 2005.06.22.22.05.34; author martin; state Exp; branches; next 1.2; 1.2 date 2005.06.20.06.56.14; author kristerw; state dead; branches; next 1.1; 1.1 date 2005.06.16.21.38.09; author martin; state Exp; branches; next ; desc @@ 1.5 log @Remove Mozilla Suite and friends. No longer maintained upstream, replaced by SeaMonkey. @ text @$NetBSD: patch-cg,v 1.4 2005/09/28 12:04:29 rillig Exp $ --- extensions/transformiix/source/base/Double.cpp.orig 2004-01-15 22:23:18.000000000 +0100 +++ extensions/transformiix/source/base/Double.cpp 2005-06-20 11:26:26.000000000 +0200 @@@@ -48,6 +48,38 @@@@ * Utility class for doubles */ +#if defined(INFINITY) && defined(NAN) +double Double::NaN() +{ + return NAN; +} + +double Double::PositiveInfinity() +{ + return INFINITY; +} + +double Double::NegativeInfinity() +{ + return -INFINITY; +} + +MBool Double::isInfinite(double aDbl) +{ + return isinf(aDbl); +} + +MBool Double::isNaN(double aDbl) +{ + return isnan(aDbl); +} + +MBool Double::isNeg(double aDbl) +{ + return aDbl<0.0; +} +#else /* pre INFINITY C environment */ + //A trick to handle IEEE floating point exceptions on FreeBSD - E.D. #ifdef __FreeBSD__ #include @@@@ -127,9 +159,20 @@@@ const PRUint32 negInfMask[2] = {0, TX_DOUBLE_HI32_EXPMASK | TX_DOUBLE_HI32_SIGNBIT}; #endif -const double Double::NaN = *((double*)nanMask); -const double Double::POSITIVE_INFINITY = *((double*)infMask); -const double Double::NEGATIVE_INFINITY = *((double*)negInfMask); +double Double::NaN() +{ + return *((double*)nanMask); +} + +double Double::PositiveInfinity() +{ + return *((double*)infMask); +} + +double Double::NegativeInfinity() +{ + return *((double*)negInfMask); +} /* * Determines whether the given double represents positive or negative @@@@ -157,6 +200,7 @@@@ { return (TX_DOUBLE_HI32(aDbl) & TX_DOUBLE_HI32_SIGNBIT) != 0; } +#endif /* C environment has INFINITY and NAN */ /* * Converts the given String to a double, if the String value does not @@@@ -244,7 +288,7 @@@@ { if (mState == eIllegal || mBuffer.IsEmpty() || (mBuffer.Length() == 1 && mBuffer[0] == '.')) { - return Double::NaN; + return Double::NaN(); } return mSign*PR_strtod(mBuffer.get(), 0); } @ 1.4 log @Added RCS Id tags. Removed trailing empty line from patch-sg. @ text @d1 1 a1 1 $NetBSD: patch-cg,v 1.3 2005/06/22 22:05:34 martin Exp $ @ 1.3 log @Re-instantiate the NAN/INFINITY fixes, this time in a way that works on older C environments as well. @ text @d1 1 a1 1 $NetBSD: patch-cg,v 1.1 2005/06/16 21:38:09 martin Exp $ a84 1 @ 1.2 log @Back out the two last changes to the floating point code, since it broke the package for NetBSD 1.6. @ text @d4 2 a5 2 +++ extensions/transformiix/source/base/Double.cpp 2005-06-16 09:47:09.000000000 +0200 @@@@ -48,114 +48,34 @@@@ d9 1 a9 47 -//A trick to handle IEEE floating point exceptions on FreeBSD - E.D. -#ifdef __FreeBSD__ -#include -#ifdef __alpha__ -fp_except_t allmask = FP_X_INV|FP_X_OFL|FP_X_UFL|FP_X_DZ|FP_X_IMP; -#else -fp_except_t allmask = FP_X_INV|FP_X_OFL|FP_X_UFL|FP_X_DZ|FP_X_IMP|FP_X_DNML; -#endif -fp_except_t oldmask = fpsetmask(~allmask); -#endif - -/** - * Macros to workaround math-bugs bugs in various platforms - */ - -/** - * Stefan Hanske reports: - * ARM is a little endian architecture but 64 bit double words are stored - * differently: the 32 bit words are in little endian byte order, the two words - * are stored in big endian`s way. - */ - -#if defined(__arm) || defined(__arm32__) || defined(_arm26__) || defined(__arm__) -#define CPU_IS_ARM -#endif - -#if (__GNUC__ == 2 && __GNUC_MINOR__ > 95) || __GNUC__ > 2 -/** - * This version of the macros is safe for the alias optimizations - * that gcc does, but uses gcc-specific extensions. - */ - -typedef union txdpun { - PRFloat64 d; - struct { -#if defined(IS_LITTLE_ENDIAN) && !defined(CPU_IS_ARM) - PRUint32 lo, hi; -#else - PRUint32 hi, lo; -#endif - } s; -} txdpun; - -#define TX_DOUBLE_HI32(x) (__extension__ ({ txdpun u; u.d = (x); u.s.hi; })) -#define TX_DOUBLE_LO32(x) (__extension__ ({ txdpun u; u.d = (x); u.s.lo; })) - -#else // __GNUC__ d14 1 a14 4 -/* We don't know of any non-gcc compilers that perform alias optimization, - * so this code should work. - */ d19 28 a47 27 -#if defined(IS_LITTLE_ENDIAN) && !defined(CPU_IS_ARM) -#define TX_DOUBLE_HI32(x) (((PRUint32 *)&(x))[1]) -#define TX_DOUBLE_LO32(x) (((PRUint32 *)&(x))[0]) -#else -#define TX_DOUBLE_HI32(x) (((PRUint32 *)&(x))[0]) -#define TX_DOUBLE_LO32(x) (((PRUint32 *)&(x))[1]) -#endif - -#endif // __GNUC__ - -#define TX_DOUBLE_HI32_SIGNBIT 0x80000000 -#define TX_DOUBLE_HI32_EXPMASK 0x7ff00000 -#define TX_DOUBLE_HI32_MANTMASK 0x000fffff - -//-- Initialize Double related constants -#ifdef IS_BIG_ENDIAN -const PRUint32 nanMask[2] = {TX_DOUBLE_HI32_EXPMASK | TX_DOUBLE_HI32_MANTMASK, - 0xffffffff}; -const PRUint32 infMask[2] = {TX_DOUBLE_HI32_EXPMASK, 0}; -const PRUint32 negInfMask[2] = {TX_DOUBLE_HI32_EXPMASK | TX_DOUBLE_HI32_SIGNBIT, 0}; -#else -const PRUint32 nanMask[2] = {0xffffffff, - TX_DOUBLE_HI32_EXPMASK | TX_DOUBLE_HI32_MANTMASK}; -const PRUint32 infMask[2] = {0, TX_DOUBLE_HI32_EXPMASK}; -const PRUint32 negInfMask[2] = {0, TX_DOUBLE_HI32_EXPMASK | TX_DOUBLE_HI32_SIGNBIT}; -#endif - d51 10 d63 1 a63 1 + return -INFINITY; d66 3 a68 5 -/* - * Determines whether the given double represents positive or negative - * inifinity - */ MBool Double::isInfinite(double aDbl) d70 1 a70 22 - return ((TX_DOUBLE_HI32(aDbl) & ~TX_DOUBLE_HI32_SIGNBIT) == TX_DOUBLE_HI32_EXPMASK && - !TX_DOUBLE_LO32(aDbl)); + return isinf(aDbl); } -/* - * Determines whether the given double is NaN - */ MBool Double::isNaN(double aDbl) { - return ((TX_DOUBLE_HI32(aDbl) & TX_DOUBLE_HI32_EXPMASK) == TX_DOUBLE_HI32_EXPMASK && - (TX_DOUBLE_LO32(aDbl) || (TX_DOUBLE_HI32(aDbl) & TX_DOUBLE_HI32_MANTMASK))); + return isnan(aDbl); } -/* - * Determines whether the given double is negative - */ MBool Double::isNeg(double aDbl) { - return (TX_DOUBLE_HI32(aDbl) & TX_DOUBLE_HI32_SIGNBIT) != 0; + return aDbl<0.0; d72 1 d75 2 a76 1 @@@@ -244,7 +164,7 @@@@ d85 1 @ 1.1 log @Redo the previous "double alignemnet" fix more completely. The previous state was completely broken. @ text @d1 1 a1 1 $NetBSD$ @