Re: bytes calculation
- From: Kelsey Bjarnason <kbjarnason@xxxxxxxxx>
- Date: Mon, 30 Jul 2007 21:08:02 GMT
On Mon, 30 Jul 2007 08:35:08 -0700, Nick Keighley wrote:
On 30 Jul, 15:55, jacob navia <ja...@xxxxxxxxxxxxxxxx> wrote:
Spoon wrote:
Pietro Cerutti wrote:
Assuming that sizeof(unsigned long long) == 64 and sizeof(int) == 32
I think you meant "Assuming CHAR_BIT == 8, sizeof(int) == 4, and
sizeof(unsigned long long) == 8".
Please, are you a lawyer?
you say that like it's a bad thing...
Note: sizeof returns the number of chars in an object (or type)
*not* the number of bits.
Can you tell me of a machine where char_bit != 8 ?
And please, a machine in use 2007 ok?
But like you I'm puzzled as to why a 32-bit shift
on a 64-bit quantity doesn't yield the top 32-bits.
Unless I misunderstood something...
unsigned long long scnlen;
int scnlen_hi;
sclen_hi = scnlen >> 32;
If the upper half of scnlen contains a value within the range of the upper
32 bits of an unsigned long long, but outside the range of a 32-bit signed
int, bad things could happen, no?
.
- Follow-Ups:
- Re: bytes calculation
- From: Pietro Cerutti
- Re: bytes calculation
- References:
- bytes calculation
- From: seema
- Re: bytes calculation
- From: Pietro Cerutti
- Re: bytes calculation
- From: Spoon
- Re: bytes calculation
- From: jacob navia
- Re: bytes calculation
- From: Nick Keighley
- bytes calculation
- Prev by Date: Re: The chart of comp.lang.c
- Next by Date: Re: bytes calculation
- Previous by thread: Re: bytes calculation
- Next by thread: Re: bytes calculation
- Index(es):
Relevant Pages
|