]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/longlong.h
Simplify preprocessor guards for render tables and new
[wxWidgets.git] / include / wx / longlong.h
index 5670a66fab343e250545fa229a55ba15ef407759..a0f98934e02230a96089569343a6ff868e1d37b8 100644 (file)
 #ifndef _WX_LONGLONG_H
 #define _WX_LONGLONG_H
 
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
-    #pragma interface "longlong.h"
-#endif
-
 #include "wx/defs.h"
 #include "wx/string.h"
 
@@ -143,10 +139,10 @@ public:
     // accessors
         // get high part
     long GetHi() const
-        { return (long)(m_ll >> 32); }
+        { return wx_truncate_cast(long, m_ll >> 32); }
         // get low part
     unsigned long GetLo() const
-        { return (unsigned long)m_ll; }
+        { return wx_truncate_cast(unsigned long, m_ll); }
 
         // get absolute value
     wxLongLongNative Abs() const { return wxLongLongNative(*this).Abs(); }
@@ -161,9 +157,12 @@ public:
         wxASSERT_MSG( (m_ll >= LONG_MIN) && (m_ll <= LONG_MAX),
                       _T("wxLongLong to long conversion loss of precision") );
 
-        return (long)m_ll;
+        return wx_truncate_cast(long, m_ll);
     }
 
+        // convert to double
+    double ToDouble() const { return wx_truncate_cast(double, m_ll); }
+
     // don't provide implicit conversion to wxLongLong_t or we will have an
     // ambiguity for all arithmetic operations
     //operator wxLongLong_t() const { return m_ll; }
@@ -215,13 +214,13 @@ public:
     // shifts
         // left shift
     wxLongLongNative operator<<(int shift) const
-        { return wxLongLongNative(m_ll << shift);; }
+        { return wxLongLongNative(m_ll << shift); }
     wxLongLongNative& operator<<=(int shift)
         { m_ll <<= shift; return *this; }
 
         // right shift
     wxLongLongNative operator>>(int shift) const
-        { return wxLongLongNative(m_ll >> shift);; }
+        { return wxLongLongNative(m_ll >> shift); }
     wxLongLongNative& operator>>=(int shift)
         { m_ll >>= shift; return *this; }
 
@@ -343,10 +342,10 @@ public:
     // accessors
         // get high part
     unsigned long GetHi() const
-        { return (unsigned long)(m_ll >> 32); }
+        { return wx_truncate_cast(unsigned long, m_ll >> 32); }
         // get low part
     unsigned long GetLo() const
-        { return (unsigned long)m_ll; }
+        { return wx_truncate_cast(unsigned long, m_ll); }
 
         // convert to native ulong long
     wxULongLong_t GetValue() const { return m_ll; }
@@ -357,7 +356,7 @@ public:
         wxASSERT_MSG( m_ll <= LONG_MAX,
                       _T("wxULongLong to long conversion loss of precision") );
 
-        return (unsigned long)m_ll;
+        return wx_truncate_cast(unsigned long, m_ll);
     }
 
     // operations
@@ -402,13 +401,13 @@ public:
     // shifts
         // left shift
     wxULongLongNative operator<<(int shift) const
-        { return wxULongLongNative(m_ll << shift);; }
+        { return wxULongLongNative(m_ll << shift); }
     wxULongLongNative& operator<<=(int shift)
         { m_ll <<= shift; return *this; }
 
         // right shift
     wxULongLongNative operator>>(int shift) const
-        { return wxULongLongNative(m_ll >> shift);; }
+        { return wxULongLongNative(m_ll >> shift); }
     wxULongLongNative& operator>>=(int shift)
         { m_ll >>= shift; return *this; }
 
@@ -590,6 +589,9 @@ public:
         return (long)m_lo;
     }
 
+        // convert to double
+    double ToDouble() const;
+
     // operations
         // addition
     wxLongLongWx operator+(const wxLongLongWx& ll) const;
@@ -798,7 +800,7 @@ public:
         // post increment operator
     wxULongLongWx& operator++(int) { return ++(*this); }
 
-        // substraction
+        // subtraction
     wxLongLongWx operator-(const wxULongLongWx& ll) const;
     wxULongLongWx& operator-=(const wxULongLongWx& ll);