long ToLong() const
{
wxASSERT_MSG( (m_ll >= LONG_MIN) && (m_ll <= LONG_MAX),
- _T("wxLongLong to long conversion loss of precision") );
+ wxT("wxLongLong to long conversion loss of precision") );
return wx_truncate_cast(long, m_ll);
}
// 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") );
+ wxASSERT_MSG( m_ll <= ULONG_MAX,
+ wxT("wxULongLong to long conversion loss of precision") );
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); }
+ //
+ // For some completely obscure reasons compiling the cast below with
+ // VC6 in DLL builds only (!) results in "error C2520: conversion from
+ // unsigned __int64 to double not implemented, use signed __int64" so
+ // we must use a different version for that compiler.
+#ifdef __VISUALC6__
+ double ToDouble() const;
#else
double ToDouble() const { return wx_truncate_cast(double, m_ll); }
#endif
long ToLong() const
{
wxASSERT_MSG( (m_hi == 0l) || (m_hi == -1l),
- _T("wxLongLong to long conversion loss of precision") );
+ wxT("wxLongLong to long conversion loss of precision") );
return (long)m_lo;
}
unsigned long ToULong() const
{
wxASSERT_MSG( m_hi == 0ul,
- _T("wxULongLong to long conversion loss of precision") );
+ wxT("wxULongLong to long conversion loss of precision") );
return (unsigned long)m_lo;
}
#endif
+// ----------------------------------------------------------------------------
+// Specialize numeric_limits<> for our long long wrapper classes.
+// ----------------------------------------------------------------------------
+
+#if wxUSE_LONGLONG_NATIVE
+
+// VC6 is known to not have __int64 specializations of numeric_limits<> in its
+// <limits> anyhow so don't bother including it, especially as it results in
+// tons of warnings because the standard header itself uses obsolete template
+// specialization syntax.
+#ifndef __VISUALC6__
+
+#include <limits>
+
+namespace std
+{
+
+template<> class numeric_limits<wxLongLong>
+ : public numeric_limits<wxLongLong_t>
+{
+};
+
+template<> class numeric_limits<wxULongLong>
+ : public numeric_limits<wxULongLong_t>
+{
+};
+
+} // namespace std
+
+#endif // !VC6
+
+#endif // wxUSE_LONGLONG_NATIVE
+
#endif // wxUSE_LONGLONG
#endif // _WX_LONGLONG_H