/* --- Conversion from C integers --- */
-#define FROM(name, type) \
+#define FROM(name, type, max) \
mp *mp_from##name(mp *d, type i) { \
MP_FROMINT(d, type, i); \
return (d); \
}
-
-FROM(short, short)
-FROM(ushort, unsigned short)
-FROM(int, int)
-FROM(uint, unsigned)
-FROM(uint32, uint32)
-FROM(long, long)
-FROM(ulong, unsigned long)
-
-#undef FROM
+MPINT_CONVERSIONS(FROM)
/* --- Conversion to C integers --- */
MP_TOINT(m, type, max, i); \
return (i); \
}
-
-TO(short, short, SHRT_MAX)
-TO(ushort, unsigned short, USHRT_MAX)
-TO(int, int, INT_MAX)
-TO(uint, unsigned, UINT_MAX)
-TO(uint32, uint32, 0xffffffff)
-TO(long, long, LONG_MAX)
-TO(ulong, unsigned long, ULONG_MAX)
+MPINT_CONVERSIONS(TO)
#undef TO