-wxString
-#if wxUSE_LONGLONG_NATIVE
-wxLongLongNative::ToString() const
-#else
-wxLongLongWx::ToString() const
-#endif
-{
- // TODO: this is awfully inefficient, anything better?
- wxString result;
-
- wxLongLong ll = *this;
-
- bool neg;
- if ( ll < 0 )
- {
- ll.Negate();
- neg = true;
- }
- else
- {
- neg = false;
+#define LL_TO_STRING(name) \
+ wxString name::ToString() const \
+ { \
+ /* TODO: this is awfully inefficient, anything better? */ \
+ wxString result; \
+ \
+ name ll = *this; \
+ \
+ bool neg; \
+ if ( ll < 0 ) \
+ { \
+ ll.Negate(); \
+ neg = true; \
+ } \
+ else \
+ { \
+ neg = false; \
+ } \
+ \
+ while ( ll != 0 ) \
+ { \
+ result.Prepend((wxChar)(_T('0') + (ll % 10).ToLong())); \
+ ll /= 10; \
+ } \
+ \
+ if ( result.empty() ) \
+ result = _T('0'); \
+ else if ( neg ) \
+ result.Prepend(_T('-')); \
+ \
+ return result; \