Bug 569629 - Modify Double::NaN,POSITIVE_INFINITY,NEGATIVE_INFINITY to avoid static initializers. r=jonas,a=bsmedberg

This commit is contained in:
Mike Hommey 2010-11-07 09:25:38 +01:00
Родитель f483b0dc8a
Коммит 91dfd2fdc1
3 изменённых файлов: 12 добавлений и 12 удалений

Просмотреть файл

@ -77,6 +77,10 @@ typedef union txdpun {
#endif
} s;
PRFloat64 d;
public:
operator double() const {
return d;
}
} txdpun;
#if (__GNUC__ == 2 && __GNUC_MINOR__ > 95) || __GNUC__ > 2

Просмотреть файл

@ -73,9 +73,9 @@ public:
/**
* Useful constants
*/
static const double NaN;
static const double POSITIVE_INFINITY;
static const double NEGATIVE_INFINITY;
static const txdpun NaN;
static const txdpun POSITIVE_INFINITY;
static const txdpun NEGATIVE_INFINITY;
/**
* Determines whether the given double represents positive or negative

Просмотреть файл

@ -50,19 +50,15 @@
*/
//-- Initialize Double related constants
const txdpun nanMask = TX_DOUBLE_NaN;
const txdpun Double::NaN = TX_DOUBLE_NaN;
#ifdef IS_BIG_ENDIAN
const txdpun infMask = {{TX_DOUBLE_HI32_EXPMASK, 0}};
const txdpun negInfMask = {{TX_DOUBLE_HI32_EXPMASK | TX_DOUBLE_HI32_SIGNBIT, 0}};
const txdpun Double::POSITIVE_INFINITY = {{TX_DOUBLE_HI32_EXPMASK, 0}};
const txdpun Double::NEGATIVE_INFINITY = {{TX_DOUBLE_HI32_EXPMASK | TX_DOUBLE_HI32_SIGNBIT, 0}};
#else
const txdpun infMask = {{0, TX_DOUBLE_HI32_EXPMASK}};
const txdpun negInfMask = {{0, TX_DOUBLE_HI32_EXPMASK | TX_DOUBLE_HI32_SIGNBIT}};
const txdpun Double::POSITIVE_INFINITY = {{0, TX_DOUBLE_HI32_EXPMASK}};
const txdpun Double::NEGATIVE_INFINITY = {{0, TX_DOUBLE_HI32_EXPMASK | TX_DOUBLE_HI32_SIGNBIT}};
#endif
const double Double::NaN = nanMask.d;
const double Double::POSITIVE_INFINITY = infMask.d;
const double Double::NEGATIVE_INFINITY = negInfMask.d;
/*
* Determines whether the given double represents positive or negative
* inifinity