How does one construct a mask fo

adm at cbneb.UUCP adm at cbneb.UUCP
Sat Mar 9 01:22:38 AEST 1985


/***** cbnap:net.lang.c / ISM780!ed /  9:14 pm  Mar  7, 1985 */

>    #define MSB (~(-1>>1))
>
>    Steve Ludlum, decvax!yale-co!ima!stevel, {cca!ihnp4!cbosgd}!ima!stevel

I think you need

#define MSB (~((unsigned)-1>>1))

Right shift is only guaranteed to fill by zeroes if the left operand is
unsigned.

Ed Lycklama
decvax!cca!ima!ism780!ed
/* ---------- */



More information about the Comp.lang.c mailing list