[courier-users] maxlongsize may be a 64-bit portability issue

2004-09-29 Thread Alessandro Vesely
The maxlongsize.h header used to define the max size of
a decimal representation of the largest long int
using the size of its string representation as given in
limits.h, i.e. (simplified slightly)

#define MAXLONGSIZE MAXLONGSIZE1(ULONG_MAX)
#define MAXLONGSIZE1(x) MAXLONGSIZE2(x)
#define MAXLONGSIZE2(x) sizeof( # x )

However, the max in limits.h can be given in hex format,
e.g. 0x rather than 4294967295. Note that since
hex format requires two extra chars 0x, it will not
be shorter than the equivalent decimal representation
unless the number has 40 or more bits.

OT: Why 40? I couldn't do better than solve
2 + log16(x) = log10(x), approx. 2^39.2


---
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
___
courier-users mailing list
[EMAIL PROTECTED]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users


Re: [courier-users] maxlongsize may be a 64-bit portability issue

2004-09-29 Thread Sam Varshavchik
Alessandro Vesely writes:
The maxlongsize.h header used to define the max size of
a decimal representation of the largest long int
using the size of its string representation as given in
limits.h, i.e. (simplified slightly)
#define MAXLONGSIZE MAXLONGSIZE1(ULONG_MAX)
#define MAXLONGSIZE1(x) MAXLONGSIZE2(x)
#define MAXLONGSIZE2(x) sizeof( # x )
However, the max in limits.h can be given in hex format,
e.g. 0x rather than 4294967295. Note that since
hex format requires two extra chars 0x, it will not
be shorter than the equivalent decimal representation
unless the number has 40 or more bits.
Thanks, I'll fix that.


pgp4Df1fMohwe.pgp
Description: PGP signature