]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/longlong.cpp
Hopefully fixed library names generated by wx-config for OS/2's PM port.
[wxWidgets.git] / src / common / longlong.cpp
index f0dad06d3816ecce41a4c0257a43f67648b98d3b..9334dcc3f478e2c0c80987423337e63326d5847b 100644 (file)
@@ -27,6 +27,7 @@
 
 #if wxUSE_LONGLONG
 #include "wx/longlong.h"
+#include "wx/math.h"       // for fabs()
 
 #if defined(__MWERKS__) && defined(__WXMSW__)
 #include <string.h>     // for memset()
@@ -34,7 +35,7 @@
 #include <memory.h>     // for memset()
 #endif
 
-#include <math.h>       // for fabs()
+#include "wx/ioswrap.h"
 
 // ============================================================================
 // implementation
@@ -752,7 +753,7 @@ wxULongLongWx& wxULongLongWx::operator*=(const wxULongLongWx& ll)
     m_hi = m_lo = 0;
 
 #ifdef wxLONGLONG_TEST_MODE
-    unsigned wxLongLong_t llOld = m_ll;
+    wxULongLong_t llOld = m_ll;
     m_ll = 0;
 #endif // wxLONGLONG_TEST_MODE
 
@@ -1093,21 +1094,24 @@ void *wxULongLongWx::asArray(void) const
                                                                      \
         name ll = *this;                                             \
                                                                      \
-        bool neg;                                                    \
-        if ( ll < 0 )                                                \
+        bool neg = ll < 0;                                           \
+        if ( neg )                                                   \
         {                                                            \
-            ll.Negate();                                             \
-            neg = true;                                              \
+            while ( ll != 0 )                                        \
+            {                                                        \
+                long digit = (ll % 10).ToLong();                     \
+                result.Prepend((wxChar)(_T('0') - digit));           \
+                ll /= 10;                                            \
+            }                                                        \
         }                                                            \
         else                                                         \
         {                                                            \
-            neg = false;                                             \
-        }                                                            \
-                                                                     \
-        while ( ll != 0 )                                            \
-        {                                                            \
-            result.Prepend((wxChar)(_T('0') + (ll % 10).ToLong()));  \
-            ll /= 10;                                                \
+            while ( ll != 0 )                                        \
+            {                                                        \
+                long digit = (ll % 10).ToLong();                     \
+                result.Prepend((wxChar)(_T('0') + digit));           \
+                ll /= 10;                                            \
+            }                                                        \
         }                                                            \
                                                                      \
         if ( result.empty() )                                        \
@@ -1151,11 +1155,13 @@ void *wxULongLongWx::asArray(void) const
 #if wxUSE_STD_IOSTREAM
 
 // input/output
+WXDLLIMPEXP_BASE
 wxSTD ostream& operator<< (wxSTD ostream& o, const wxLongLong& ll)
 {
     return o << ll.ToString();
 }
 
+WXDLLIMPEXP_BASE
 wxSTD ostream& operator<< (wxSTD ostream& o, const wxULongLong& ll)
 {
     return o << ll.ToString();
@@ -1163,4 +1169,14 @@ wxSTD ostream& operator<< (wxSTD ostream& o, const wxULongLong& ll)
 
 #endif // wxUSE_STD_IOSTREAM
 
+WXDLLIMPEXP_BASE wxString& operator<< (wxString& s, const wxLongLong& ll)
+{
+    return s << ll.ToString();
+}
+
+WXDLLIMPEXP_BASE wxString& operator<< (wxString& s, const wxULongLong& ll)
+{
+    return s << ll.ToString();
+}
+
 #endif // wxUSE_LONGLONG