#endif
#if wxUSE_LONGLONG
-
#include "wx/longlong.h"
#include <memory.h> // for memset()
+#include <math.h> // for fabs()
// ============================================================================
// implementation
#endif // wxUSE_LONGLONG_NATIVE
+// ============================================================================
+// wxLongLongWx: emulation of 'long long' using 2 longs
+// ============================================================================
+
#if wxUSE_LONGLONG_WX
+// assignment
+wxLongLongWx& wxLongLongWx::Assign(double d)
+{
+ if ( fabs(d) <= LONG_MAX )
+ {
+ m_hi = d < 0 ? 1 << (8*sizeof(long) - 1) : 0l;
+ m_lo = (long)d;
+ }
+ else
+ {
+ wxFAIL_MSG(_T("TODO"));
+ }
+
+ return *this;
+}
+
wxLongLongWx wxLongLongWx::operator<<(int shift) const
{
if (shift == 0)
if (previous < ll.m_lo)
m_hi--;
- return *this;;
+ return *this;
}
// pre decrement
{
static unsigned char temp[8];
- temp[0] = (m_hi >> 24) & 0xFF;
- temp[1] = (m_hi >> 16) & 0xFF;
- temp[2] = (m_hi >> 8) & 0xFF;
- temp[3] = (m_hi >> 0) & 0xFF;
- temp[4] = (m_lo >> 24) & 0xFF;
- temp[5] = (m_lo >> 16) & 0xFF;
- temp[6] = (m_lo >> 8) & 0xFF;
- temp[7] = (m_lo >> 0) & 0xFF;
+ temp[0] = (char)((m_hi >> 24) & 0xFF);
+ temp[1] = (char)((m_hi >> 16) & 0xFF);
+ temp[2] = (char)((m_hi >> 8) & 0xFF);
+ temp[3] = (char)((m_hi >> 0) & 0xFF);
+ temp[4] = (char)((m_lo >> 24) & 0xFF);
+ temp[5] = (char)((m_lo >> 16) & 0xFF);
+ temp[6] = (char)((m_lo >> 8) & 0xFF);
+ temp[7] = (char)((m_lo >> 0) & 0xFF);
return temp;
}