How does one construct a mask for the MS bit?
P. Tucker Withington
ptw at encore.UUCP
Tue Mar 5 03:03:47 AEST 1985
>> This would require generation of a mask for the most significant bit
It should be easy to make a constant that masks a machine's "high" bit, but
as I mentioned a while back, ~(~(unsigned)0>>1) croaks pcc in a static
declaration; apparently because it does not know how to simplify casts in a
constant. (It works fine as auto or in an expression, but then you're doing
unnecessary work at run time, especially if you made it a #define.)
The only feedback I got was that you "should" be allowed to have casts in a
constant; that they were "accidentally" left out of K&R...
o.o --tucker
~
More information about the Comp.lang.c
mailing list