X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2a31049201e9c1ff9f515eb9d144ae392f4b4e5a..236a9de39afa090fdee3cf91cb5364ceca69e3f8:/src/common/longlong.cpp?ds=inline diff --git a/src/common/longlong.cpp b/src/common/longlong.cpp index 6a0cc8e315..4569d208af 100644 --- a/src/common/longlong.cpp +++ b/src/common/longlong.cpp @@ -70,7 +70,7 @@ ostream& operator<< (ostream& o, const wxLongLongNative& ll) for (int i = 0; i < 64; i++) { - result[63 - i] = '0' + (char) ((ll.m_ll >> i) & 1); + result[63 - i] = '0' + (char) ((ll.GetValue() >> i) & 1); } return o << result; @@ -91,34 +91,26 @@ wxLongLongWx& wxLongLongWx::Assign(double d) { bool positive = d >= 0; d = fabs(d); - if ( d <= LONG_MAX ) + if ( d <= ULONG_MAX ) { m_hi = 0; m_lo = (long)d; } else { -#if 0 - m_lo = (long)d; - d -= m_lo; - d /= 0x1000; - d /= 0x1000; - d /= 0x100; - m_hi = (long)d; -#else - wxFAIL_MSG(_T("TODO")); -#endif + m_hi = (unsigned long)(d / (1.0 + (double)ULONG_MAX)); + m_lo = (unsigned long)(d - ((double)m_hi * (1.0 + (double)ULONG_MAX))); } - if ( !positive ) - m_hi = -m_hi; - #ifdef wxLONGLONG_TEST_MODE m_ll = (wxLongLong_t)d; Check(); #endif // wxLONGLONG_TEST_MODE + if ( !positive ) + Negate(); + return *this; } @@ -599,7 +591,9 @@ wxLongLongWx& wxLongLongWx::operator/=(const wxLongLongWx& ll) Divide(ll, quotient, remainder); - return *this = quotient; + *this = quotient; + + return *this; } wxLongLongWx wxLongLongWx::operator%(const wxLongLongWx& ll) const