X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2a31049201e9c1ff9f515eb9d144ae392f4b4e5a..acc0ebd7a871124d4d6b36069340227e6c584f38:/src/common/longlong.cpp?ds=inline diff --git a/src/common/longlong.cpp b/src/common/longlong.cpp index 6a0cc8e315..129af17c8f 100644 --- a/src/common/longlong.cpp +++ b/src/common/longlong.cpp @@ -60,17 +60,17 @@ void *wxLongLongNative::asArray() const #if wxUSE_STD_IOSTREAM // input/output -ostream& operator<< (ostream& o, const wxLongLongNative& ll) +wxSTD ostream& operator<< (wxSTD ostream& o, const wxLongLongNative& ll) { char result[65]; - memset(result, 'A', 64); + wxSTD memset(result, 'A', 64); result[64] = '\0'; 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 @@ -635,7 +629,7 @@ void *wxLongLongWx::asArray(void) const #if wxUSE_STD_IOSTREAM // input/output -ostream& operator<< (ostream& o, const wxLongLongWx& ll) +wxSTD ostream& operator<< (wxSTD ostream& o, const wxLongLongWx& ll) { char result[65];