Re: Implemenation Indepdent Way to Move LSByte of Char to MSB of Int, etc
From: bd (bdonlan_at_gmail.com)
Date: 01/17/05
- Next message: bd: "Re: accessing freed memory without error"
- Previous message: bd: "Re: c equivilant to "copy""
- In reply to: Eric Sosman: "Re: Implemenation Indepdent Way to Move LSByte of Char to MSB of Int, etc"
- Next in thread: Eric Sosman: "Re: Implemenation Indepdent Way to Move LSByte of Char to MSB of Int, etc"
- Reply: Eric Sosman: "Re: Implemenation Indepdent Way to Move LSByte of Char to MSB of Int, etc"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 17 Jan 2005 15:00:53 -0500
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Eric Sosman wrote:
[...]
> Maybe there's a way to calculate (UINT_MAX + 1)/(UCHAR_MAX + 1)
> without risking zero in the numerator and/or denominator, but I
> haven't figured one out. (Note that UCHAR_MAX == ULLONG_MAX is
> permitted by the Standard.)
Since UCHAR_MAX <= UINT_MAX <= ULLONG_MAX...
#if UCHAR_MAX == ULLONG_MAX
# define UINT_UCHAR_RATIO 1
#else
# define UINT_UCHAR_RATIO \
(((unsigned long long)UINT_MAX + 1) / \
((unsigned long long)UCHAR_MAX + 1))
#endif
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)
iD8DBQFB7Bl1+hz2VlChukwRAoaVAJ0Zh2DOJwBXkeNRuyG/Jd0h9dx5cACcCD6a
ybh2nBGeJaFbYrAwuhhhMhA=
=otfo
-----END PGP SIGNATURE-----
- Next message: bd: "Re: accessing freed memory without error"
- Previous message: bd: "Re: c equivilant to "copy""
- In reply to: Eric Sosman: "Re: Implemenation Indepdent Way to Move LSByte of Char to MSB of Int, etc"
- Next in thread: Eric Sosman: "Re: Implemenation Indepdent Way to Move LSByte of Char to MSB of Int, etc"
- Reply: Eric Sosman: "Re: Implemenation Indepdent Way to Move LSByte of Char to MSB of Int, etc"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|