From: Albert Schlef Date: 2009-01-29T11:11:44+09:00 Subject: Re: Bitwise question Pascal J. Bourguignon wrote: > Albert Schlef writes: > > One, you need to do (1 << (b-1)). > Bit 0 is the first bit. 2^0 = 1 I stand corrected. > > Two, if you pass [] as the bits, the > > result will be 'true'. > > Which is of course the correct answer. > All the bits in the empty set are in any bitfield. > There is no bit in the empty set hat are not in a given bitfield. All right, all right, you win ;-) I now see that [].all? too returns 'true'. (So my attempt at dissuading you from using parenthesis failed miserably. Say, won't you consider dropping them for humanitarian reasons?) -- Posted via http://www.ruby-forum.com/.