typedef typename TypeChooser<PlatformUnsignedTypes, Predicate>::Type UnsignedType;
};
+/** A helper for choosing an integer that's the same size as another type. */
+template<typename T>
+struct MatchingInt: Int<sizeof(T)*CHAR_BIT>
+{ };
+
// Finally define convenient shorthands for the actual integer types
typedef Int<8>::SignedType Int8;
typedef Int<8>::UnsignedType UInt8;
typedef Int<32>::UnsignedType UInt32;
typedef Int<64>::SignedType Int64;
typedef Int<64>::UnsignedType UInt64;
+typedef MatchingInt<void *>::UnsignedType IntPtr;
} // namespace Msp
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>
-{
- typedef UInt64 Type;
-};
-
/* 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>> ***/