Long Shifty Bits

Tim Hochberg tim.hochberg at ieee.org
Tue Mar 6 15:19:23 EST 2001


Have you tried it and found a problem?

My understanding is that this stuff should "just work"with long integers.
Not that I've tried it, since this isn't my problem domain. Trying your
particular problem one gets:

>>> x = 1L << 200
>>> hex(x)
'0x100000000000000000000000000000000000000000000000000L'

Which appears, at least to casual inspection,  to be the correct answer.

-tim

"Phlip" <phlip_cpp at my-deja.com> wrote in message
news:kmap6.15$8Q.28605 at news.pacbell.net...
> Not hyp:
>
> I want this expression to make sense:
>
>         x = 1L << 200
>
> If someone tells me "it will roll over at the 32nd bit", or mayby even "it
> will roll over when the CPU damn well feels like it", that's okay. I'l
just
> construct a Bit Vector of some ilk and drop my bits into it. But the above
> notation is closest to our problem space, so it would be nice if it worked
> as expected.
>
> --
>   Phlip                          phlip_cpp at my-deja.com
> ============== http://phlip.webjump.com ==============
>   --  "In my experience, the customer doesn't know what he wants
>        until you don't give it to him." --David Brady  --





More information about the Python-list mailing list