]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/longlong.cpp
2 warnings from Solaris build log fixed
[wxWidgets.git] / src / common / longlong.cpp
index 6a0cc8e315a4c91eddd175f102fe634fb649dfa3..d85b5420fb4b017f5316c7ff7e3a9be8cd85bd45 100644 (file)
@@ -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