#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(); }
// convert to native long long
wxLongLong_t GetValue() const { return m_ll; }
- // convert to long with range checking in the debug mode (only!)
+ // convert to long with range checking in debug mode (only!)
long ToLong() const
{
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 m_ll; }
+ 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
// 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; }
- // convert to ulong with range checking in the debug mode (only!)
+ // convert to ulong with range checking in debug mode (only!)
unsigned long ToULong() const
{
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
return *this;
}
- // convert to long with range checking in the debug mode (only!)
+ // convert to long with range checking in debug mode (only!)
long ToLong() const
{
wxASSERT_MSG( (m_hi == 0l) || (m_hi == -1l),
// get low part
unsigned long GetLo() const { return m_lo; }
- // convert to long with range checking in the debug mode (only!)
+ // convert to long with range checking in debug mode (only!)
unsigned long ToULong() const
{
wxASSERT_MSG( m_hi == 0ul,