On 5/12/07, Sebastian Hungerecker <sepp2k / googlemail.com> wrote:
> Human Dunnil wrote:
> > @num_sources = sources.size
> > @num_hashes = 1 << @num_sources
> >
> > I think << here is doing bit manipulation
>
> It is.
>
> > which I do not get!
>
> 1<<x is the same as 2**x. If you think about it for a bit or try to solve 1<<x
> with pencil and paper, it'll become apparent why.

Or more generally

if x is a Fixnum or Bignum then

  x << i

is the same as
  x * 2**i

-- 
Rick DeNatale

My blog on Ruby
http://talklikeaduck.denhaven2.com/