Re: NEWBIE: warning: left shift count >= width of type (fwd)

From: Naved A Surve (naved@mailhost.taponline.com)
Date: 05/10/96


In message <Pine.ULT.3.91.960510114029.7896A-100000@po.EECS.Berkeley.EDU> you s
aid:
> Naved points out:
>   On a 32 bit machine the maximum shift is 31.    (0 - 31)
> 
> I've noted that, strangely enough, on some machines, (1 << 31) will
> screw up the sprintbit function.  This, I'm pretty sure, is because of
> the sign of the int.  Sprintbit checks if the number is less than zero,
> and most machines have the sign bit in slot 31.

You can only achieve the maximum number of bitflags in a vector if the
vector is an unsigned datatype.

> yet another way suggested is probably better, using bitfields, but then, 
> you'd have to compile with c++

No you don't.  bitfields are a part of the C language.


Naved



This archive was generated by hypermail 2b30 : 12/18/00 PST