Subj : Re: possible overflow? To : comp.programming From : Markus Becker Date : Sun Aug 21 2005 05:46 pm Hi, it's more like an underflow ... mr_semantics@hotmail.com schrieb: > j = (1 << (number_of_bits - 1)); ==== This "1" is an 'int', you have to cast it to long before shifting. j = (1L <<(numbits-1)); should do the trick. > for (i = 1; i != 0; i <<= 1) { Why not: for (i=0; i