]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/longlong.h
test
[wxWidgets.git] / include / wx / longlong.h
index 5f0b7129476f0be0ec631027ae82359d35b4b6fc..cedac4f92b6b53cb3206213eec0cade5c6df613d 100644 (file)
     #define wxUSE_LONGLONG_NATIVE 0
     class WXDLLEXPORT wxLongLongWx;
     typedef wxLongLongWx wxLongLong;
+#else
+    // if nothing is defined, use native implementation by default, of course
+    #ifndef wxUSE_LONGLONG_NATIVE
+        #define wxUSE_LONGLONG_NATIVE 1
+    #endif
 #endif
 
 #ifndef wxUSE_LONGLONG_WX
@@ -107,15 +112,18 @@ public:
     // accessors
         // get high part
     long GetHi() const
-        { return (long)((m_ll & 0xFFFFFFFF00000000ll) >> 32); }
+        { return (long)((m_ll & 0xFFFFFFFF00000000l) >> 32); }
         // get low part
     unsigned long GetLo() const
-        { return (unsigned long) (m_ll & 0x00000000FFFFFFFFll); }
+        { return (unsigned long) (m_ll & 0x00000000FFFFFFFFl); }
+
+        // get absolute value
+    wxLongLongNative& Abs() { if ( m_ll < 0 ) m_ll = -m_ll; return *this; }
 
         // convert to native long long
     wxLongLong_t GetValue() const { return m_ll; }
 
-    operator wxLongLong_t() const { return m_ll; }
+    //operator wxLongLong_t() const { return m_ll; }
 
     // operations
         // addition
@@ -189,7 +197,7 @@ public:
     wxLongLongNative& operator^=(const wxLongLongNative& ll)
         { m_ll ^= ll.m_ll; return *this; }
 
-    // multiplication/division TODO
+    // multiplication/division
     wxLongLongNative operator*(const wxLongLongNative& ll) const
         { return wxLongLongNative(m_ll * ll.m_ll); }
     wxLongLongNative& operator*=(const wxLongLongNative& ll)
@@ -197,32 +205,48 @@ public:
 
     wxLongLongNative operator/(const wxLongLongNative& ll) const
         { return wxLongLongNative(m_ll / ll.m_ll); }
+    wxLongLongNative operator/(long l) const
+        { return wxLongLongNative(m_ll / l); }
     wxLongLongNative& operator/=(const wxLongLongNative& ll)
         { m_ll /= ll.m_ll; return *this; }
 
     wxLongLongNative operator%(const wxLongLongNative& ll) const
         { return wxLongLongNative(m_ll % ll.m_ll); }
+    wxLongLongNative operator%(long l) const
+        { return wxLongLongNative(m_ll % l); }
 
     // comparison
     bool operator==(const wxLongLongNative& ll) const
         { return m_ll == ll.m_ll; }
+    bool operator==(long l) const
+        { return m_ll == l; }
     bool operator!=(const wxLongLongNative& ll) const
         { return m_ll != ll.m_ll; }
+    bool operator!=(long l) const
+        { return m_ll != l; }
     bool operator<(const wxLongLongNative& ll) const
         { return m_ll < ll.m_ll; }
+    bool operator<(long l) const
+        { return m_ll < l; }
     bool operator>(const wxLongLongNative& ll) const
         { return m_ll > ll.m_ll; }
+    bool operator>(long l) const
+        { return m_ll > l; }
     bool operator<=(const wxLongLongNative& ll) const
         { return m_ll <= ll.m_ll; }
+    bool operator<=(long l) const
+        { return m_ll <= l; }
     bool operator>=(const wxLongLongNative& ll) const
         { return m_ll >= ll.m_ll; }
+    bool operator>=(long l) const
+        { return m_ll >= l; }
 
     // miscellaneous
         // conversion to byte array: returns a pointer to static buffer!
     void *asArray() const;
 
         // input/output
-    friend std::ostream& operator<<(ostream&, const wxLongLongNative&);
+    friend ostream& operator<<(ostream&, const wxLongLongNative&);
 
 private:
     wxLongLong_t  m_ll;
@@ -324,7 +348,7 @@ public:
                 wxLongLongWx& remainder) const;
 
     // input/output
-    friend ostream& operator<<(std::ostream&, const wxLongLongWx&);
+    friend ostream& operator<<(ostream&, const wxLongLongWx&);
 
 private:
     // long is at least 32 bits, so represent our 64bit number as 2 longs