wxLongLongWx::Assign(double) works - thanks Guillermo
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5299 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
64d8470859
commit
617ec45690
@ -27,8 +27,10 @@
|
|||||||
|
|
||||||
// define this to compile wxLongLongWx in "test" mode: the results of all
|
// define this to compile wxLongLongWx in "test" mode: the results of all
|
||||||
// calculations will be compared with the real results taken from
|
// calculations will be compared with the real results taken from
|
||||||
// wxLongLongNative
|
// wxLongLongNative -- this is extremely useful to find the bugs in
|
||||||
#define wxLONGLONG_TEST_MODE
|
// wxLongLongWx class!
|
||||||
|
|
||||||
|
//#define wxLONGLONG_TEST_MODE
|
||||||
|
|
||||||
#ifdef wxLONGLONG_TEST_MODE
|
#ifdef wxLONGLONG_TEST_MODE
|
||||||
#define wxUSE_LONGLONG_WX 1
|
#define wxUSE_LONGLONG_WX 1
|
||||||
|
@ -91,34 +91,26 @@ wxLongLongWx& wxLongLongWx::Assign(double d)
|
|||||||
{
|
{
|
||||||
bool positive = d >= 0;
|
bool positive = d >= 0;
|
||||||
d = fabs(d);
|
d = fabs(d);
|
||||||
if ( d <= LONG_MAX )
|
if ( d <= ULONG_MAX )
|
||||||
{
|
{
|
||||||
m_hi = 0;
|
m_hi = 0;
|
||||||
m_lo = (long)d;
|
m_lo = (long)d;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if 0
|
m_hi = (unsigned long)(d / (1.0 + (double)ULONG_MAX));
|
||||||
m_lo = (long)d;
|
m_lo = (unsigned long)(d - ((double)m_hi * (1.0 + (double)ULONG_MAX)));
|
||||||
d -= m_lo;
|
|
||||||
d /= 0x1000;
|
|
||||||
d /= 0x1000;
|
|
||||||
d /= 0x100;
|
|
||||||
m_hi = (long)d;
|
|
||||||
#else
|
|
||||||
wxFAIL_MSG(_T("TODO"));
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !positive )
|
|
||||||
m_hi = -m_hi;
|
|
||||||
|
|
||||||
#ifdef wxLONGLONG_TEST_MODE
|
#ifdef wxLONGLONG_TEST_MODE
|
||||||
m_ll = (wxLongLong_t)d;
|
m_ll = (wxLongLong_t)d;
|
||||||
|
|
||||||
Check();
|
Check();
|
||||||
#endif // wxLONGLONG_TEST_MODE
|
#endif // wxLONGLONG_TEST_MODE
|
||||||
|
|
||||||
|
if ( !positive )
|
||||||
|
Negate();
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user