test for greg

This commit is contained in:
Dave Schuyler 2005-04-30 01:34:54 +00:00
parent bb0c57bcd8
commit 866645f18c

View File

@ -311,11 +311,14 @@ class ClockDelta(DirectObject.DirectObject):
Preserves the lower NetworkTimeBits of the networkTime value, Preserves the lower NetworkTimeBits of the networkTime value,
and extends the sign bit all the way up. and extends the sign bit all the way up.
""" """
if networkTime < 0: if 1:
# flip the sign, mask it as if it were positive, flip the sign back: r = ((networkTime & NetworkTimeMask) << NetworkTimeTopBits) >> NetworkTimeTopBits
r = (networkTime * -1 & NetworkTimeSignedMask) * -1
else: else:
r = networkTime & NetworkTimeSignedMask if networkTime < 0:
# flip the sign, mask it as if it were positive, flip the sign back:
r = (networkTime * -1 & NetworkTimeSignedMask) * -1
else:
r = networkTime & NetworkTimeSignedMask
assert -32768 <= r <= 32767 assert -32768 <= r <= 32767
return r return r