bug?

Ingo Krabbe ikrabbe@earthling.net
Tue Jun 19 05:55:00 GMT 2001


On 19 Jun 2001, Alexandre Oliva wrote:
> > That's a kind of why I used ~(~(x^x)<<(sizeof(x)*8-n)).
>
> Make the `8' `CHAR_BIT'.  BTW, did you consider what happens if x is
> narrower than size_t (the type of sizeof(x)) for both signed and
> unsigned integer types?

Hmm, I considered that sizeof(x) returns the size of bytes which has a
length of 8 though a char may be longer ?!
Then I considered that ~(x^x) gives a stream of '1' as long as x. Anything
above x doesn't matter because thats not copied back into x ?!

With my machine this works for anything from char to unsigned long long !!

CU INGO




More information about the Gcc-help mailing list