#include <cmath>
#include <limits>
+#include <msp/core/inttypes.h>
#include "format.h"
#include "lexicalcast.h"
struct IsSigned
{ enum { result = !(static_cast<T>(-1)>0) }; };
-template<typename T, bool f = (sizeof(T)>sizeof(unsigned long))>
-struct Temporary
-{ typedef unsigned long Type; };
-
-template<typename T>
-struct Temporary<T, true>
-{
-#ifdef WIN32
- typedef __int64 Type;
-#else
- typedef unsigned long long Type;
-#endif
-};
-
/* Helper to avoid warnings about an unsigned type never being < 0 */
template<typename T, bool f = IsSigned<T>::result>
struct IsNegative
const char *digits = (f.get_uppercase() ? udigits : ldigits);
if(v)
{
- typename Temporary<T>::Type w = Absolute<T>::eval(v);
+ typename MatchingInt<T>::UnsignedType w = Absolute<T>::eval(v);
while(w)
{
*--ptr = digits[w%base];
{ c.result(str_to_str(s, c.get_fmt())); }
void operator<<(LexicalConverter &c, const void *p)
-{ c.result(int_to_str(reinterpret_cast<unsigned long>(p), c.get_fmt())); }
+{ c.result(int_to_str(reinterpret_cast<IntPtr>(p), c.get_fmt())); }
/*** operator>> ***/