Re: Unsigned Long Long
Re: Unsigned Long Long
- Subject: Re: Unsigned Long Long
- From: Clark Cox <email@hidden>
- Date: Wed, 12 May 2004 22:05:50 -0400
On May 12, 2004, at 21:15, Sherm Pendley wrote:
>
On May 12, 2004, at 5:39 PM, Fritz Anderson wrote:
>
>
> An unsigned long long is simply a 64-bit integer, in the range 0 ..
>
> (2^64)-1.
>
>
Just to pick nits - the C99 standard requires it to be a minimum of
>
64-bits wide, but allows it to be bigger. Always use sizeof() if
>
knowing the exact storage size is important to you.
You start off by mentioning that the standard doesn't impose a maximum
size for the integer types...
>
>
> You do arithmetic on it the same way you'd do it on any other
>
> integer. Divide by 1024 to get KB.
>
>
Bit-shifting is faster than division:
...but then you make a statement that is also not supported by the
standard.
>
long long kb = b << 10;
It is far less clear what the actual intent here is
>
Assuming of course that GCC doesn't optimize division by a constant
>
power of 2 into a bit-shift on its own.
That is a bad assumption to make, for something so easily testable,
there is no need to assume.
--
Clark S. Cox III
email@hidden
http://homepage.mac.com/clarkcox3/
http://homepage.mac.com/clarkcox3/blog/B1196589870/index.html
[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.