[Zodb-checkins] CVS: StandaloneZODB/ZODB - utils.py:1.6

Tim Peters tim@zope.com
Fri, 5 Oct 2001 16:40:33 -0400


[Jeremy Hylton]
> Modified Files:
> 	utils.py
> Log Message:
> Revert previous checkin; caused massive test failures.

...

>  def U64(v, unpack=struct.unpack):
>      """Same as u64 but always returns a long."""
>      h, v = unpack(">II", v)
>      if h:
> -        v = (h << 32) + v
> +        v=h*t32+v
>      return v

If you're running on a 32-bit box, the "-" line sets v to itself (i.e., does
nothing useful), because "h << 32" always returns 0.  Change it to

    v = (long(h) << 32) + v

and it should work fine, and much quicker than multiplying.