// from long long
wxLongLongNative(wxLongLong_t ll) : m_ll(ll) { }
// from 2 longs
- wxLongLongNative(long hi, unsigned long lo) : m_ll(0)
+ wxLongLongNative(wxInt32 hi, wxUint32 lo)
{
- // assign first to avoid precision loss!
+ // cast to wxLongLong_t first to avoid precision loss!
m_ll = ((wxLongLong_t) hi) << 32;
m_ll |= (wxLongLong_t) lo;
}
// assignment operators
// from native 64 bit integer
+#ifndef wxLongLongIsLong
wxLongLongNative& operator=(wxLongLong_t ll)
{ m_ll = ll; return *this; }
wxLongLongNative& operator=(wxULongLong_t ll)
{ m_ll = ll; return *this; }
+#endif // !wxLongLongNative
wxLongLongNative& operator=(const wxULongLongNative &ll);
wxLongLongNative& operator=(int l)
{ m_ll = l; return *this; }
wxLongLongNative& operator=(long l)
{ m_ll = l; return *this; }
+ wxLongLongNative& operator=(unsigned int l)
+ { m_ll = l; return *this; }
wxLongLongNative& operator=(unsigned long l)
{ m_ll = l; return *this; }
#if wxUSE_LONGLONG_WX
// accessors
// get high part
- long GetHi() const
- { return wx_truncate_cast(long, m_ll >> 32); }
+ wxInt32 GetHi() const
+ { return wx_truncate_cast(wxInt32, m_ll >> 32); }
// get low part
- unsigned long GetLo() const
- { return wx_truncate_cast(unsigned long, m_ll); }
+ wxUint32 GetLo() const
+ { return wx_truncate_cast(wxUint32, m_ll); }
// get absolute value
wxLongLongNative Abs() const { return wxLongLongNative(*this).Abs(); }
// from long long
wxULongLongNative(wxULongLong_t ll) : m_ll(ll) { }
// from 2 longs
- wxULongLongNative(unsigned long hi, unsigned long lo) : m_ll(0)
+ wxULongLongNative(wxUint32 hi, wxUint32 lo) : m_ll(0)
{
- // assign first to avoid precision loss!
+ // cast to wxLongLong_t first to avoid precision loss!
m_ll = ((wxULongLong_t) hi) << 32;
m_ll |= (wxULongLong_t) lo;
}
// assignment operators
// from native 64 bit integer
+#ifndef wxLongLongIsLong
wxULongLongNative& operator=(wxULongLong_t ll)
{ m_ll = ll; return *this; }
wxULongLongNative& operator=(wxLongLong_t ll)
{ m_ll = ll; return *this; }
+#endif // !wxLongLongNative
wxULongLongNative& operator=(int l)
{ m_ll = l; return *this; }
wxULongLongNative& operator=(long l)
{ m_ll = l; return *this; }
+ wxULongLongNative& operator=(unsigned int l)
+ { m_ll = l; return *this; }
wxULongLongNative& operator=(unsigned long l)
{ m_ll = l; return *this; }
wxULongLongNative& operator=(const wxLongLongNative &ll)
// accessors
// get high part
- unsigned long GetHi() const
- { return wx_truncate_cast(unsigned long, m_ll >> 32); }
+ wxUint32 GetHi() const
+ { return wx_truncate_cast(wxUint32, m_ll >> 32); }
// get low part
- unsigned long GetLo() const
- { return wx_truncate_cast(unsigned long, m_ll); }
+ wxUint32 GetLo() const
+ { return wx_truncate_cast(wxUint32, m_ll); }
// convert to native ulong long
wxULongLong_t GetValue() const { return m_ll; }
return wx_truncate_cast(unsigned long, m_ll);
}
+ // convert to double
+#ifdef _MSC_VER
+ double ToDouble() const { return wx_truncate_cast(double, (__int64) m_ll); }
+#else
+ double ToDouble() const { return wx_truncate_cast(double, m_ll); }
+#endif
+
// operations
// addition
wxULongLongNative operator+(const wxULongLongNative& ll) const
return *this;
}
+
+ wxLongLongWx& operator=(unsigned int l)
+ {
+ return operator=((unsigned long)l);
+ }
+
wxLongLongWx& operator=(const class wxULongLongWx &ll);
// from double
return (unsigned long)m_lo;
}
+ // convert to double
+ double ToDouble() const;
+
// operations
// addition
wxULongLongWx operator+(const wxULongLongWx& ll) const;