From 8580dddb60d2b40bcffa410820d0f08ce3ca183a Mon Sep 17 00:00:00 2001 From: Dave Schuyler Date: Sat, 30 Apr 2005 02:59:32 +0000 Subject: [PATCH] sign extend now generates the same output for 2.2.2 and 2.4.1 (python versions) --- direct/src/distributed/ClockDelta.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/direct/src/distributed/ClockDelta.py b/direct/src/distributed/ClockDelta.py index 0bc3d5c866..480508a280 100644 --- a/direct/src/distributed/ClockDelta.py +++ b/direct/src/distributed/ClockDelta.py @@ -311,14 +311,9 @@ class ClockDelta(DirectObject.DirectObject): Preserves the lower NetworkTimeBits of the networkTime value, and extends the sign bit all the way up. """ - if 1: - r = ((networkTime & NetworkTimeMask) << NetworkTimeTopBits) >> NetworkTimeTopBits - else: - 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 + # this may not be exacly what is wanted (it wraps the value), but + # it matches the output that the old code did with Python 2.2.2. + r = ((networkTime+32768) & NetworkTimeMask) - 32768 assert -32768 <= r <= 32767 return r