Mail Archives: djgpp/1998/01/15/03:24:58
>>Sorry, I was wrong. The ANSI C Standard explicitly says that signed bit
>>fields of size N can be used to represent values in the range [0,
2^(N-1))
>>so when N is 1, you cannot represent 1. You need to make it unsigned, as
even worse... for N=1 you can use values in range 0 <= x <= -1 i.e. none!
;-)
>>Nate suggested.
>
>Oughtn't that to be:
>[0..(2^(N-1))-1] ?
>Because, for instance, a 16-bit signed value can only go up to 32767.
you both are right! if you look better you will see a ')' where you put a
']'!
Both [a..b-1] and [a..b) specify the same range of integers x such that
a<=x<b.
ciao
Giacomo
- Raw text -