#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"
// 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(); }
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; }
// 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; }
// 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; }
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
// 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; }
return (long)m_lo;
}
+ // convert to double
+ double ToDouble() const;
+
// operations
// addition
wxLongLongWx operator+(const wxLongLongWx& ll) const;
// post increment operator
wxULongLongWx& operator++(int) { return ++(*this); }
- // substraction
+ // subtraction
wxLongLongWx operator-(const wxULongLongWx& ll) const;
wxULongLongWx& operator-=(const wxULongLongWx& ll);