Jaakko Heinonen <[email protected]> writes:
> I am not sure if you understood what I meant here. Casting to uintmax_t
> is obviously more correct but print_number() will still print the
> negative range in "64-bit" format on i386.
Hmm, you are right, it would have worked if *i was first cast to an
unsigned type of the correct size. Unfortunately, the print_number()
macro does not know the correct size, so we have to play games with
sizeof() and hope the compiler optimizes away the unused code:
@@ -113,6 +114,8 @@
#define print_number(i,n,c) do { \
if (decimal) \
printf("%c%jd", c, (intmax_t)*i); \
+ else if (sizeof(*i) == sizeof(long)) \
+ printf("%c%#lx", c, (unsigned long)*i); \
else \
printf("%c%#jx", c, (uintmax_t)*i); \
i++; \
The root of the problem is that register_t is signed, which it shouldn't
be, IMHO.
DES
--
Dag-Erling Smørgrav - [email protected]
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"