lua-users home
lua-l archive

hex conversions?

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I seem to think there is a better way to do hex conversions, but as a 
obvious solution I tried tonumber().
But tonumber uses signed longs to do the conversion so 
tonumber('ABCC41B4',16) == 2147483647 (hint: it should be 2882290100)
since strtol returns LONG_MAX if the number overflows.
So can we change to strtoul instead (are people really using signed 
numbers in other bases?).
Russ

AltStyle によって変換されたページ (->オリジナル) /