From: Mark Slee Date: Tue, 3 Apr 2007 03:16:11 +0000 (+0000) Subject: PHP new build fix for TBinaryProtocol X-Git-Tag: 0.2.0~1393 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=13a0d4a3d6dba9fbbee4b0be189c8188cc055a5f;p=common%2Fthrift.git PHP new build fix for TBinaryProtocol Reviewed By: shire git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665079 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/lib/php/src/protocol/TBinaryProtocol.php b/lib/php/src/protocol/TBinaryProtocol.php index 9aa30832..962fcfed 100644 --- a/lib/php/src/protocol/TBinaryProtocol.php +++ b/lib/php/src/protocol/TBinaryProtocol.php @@ -309,13 +309,19 @@ class TBinaryProtocol extends TProtocol { } } else { + // Upcast negatives in LSB bit + if ($arr[2] & 0x80000000) { + $arr[2] = $arr[2] & 0xffffffff; + } + // Check for a negative if ($arr[1] & 0x80000000) { - $arr[1] = $arr[1] ^ 0xFFFFFFFF; - $arr[2] = $arr[2] ^ 0xFFFFFFFF; - $value = 0 - $arr[1]*4294967296 - $arr[2] - 1; + $arr[1] = $arr[1] & 0xffffffff; + $arr[1] = $arr[1] ^ 0xffffffff; + $arr[2] = $arr[2] ^ 0xffffffff; + $value = 0 - $arr[1]*4294967296 - $arr[2] - 1; } else { - $value = $arr[1]*4294967296 + $arr[2]; + $value = $arr[1]*4294967296 + $arr[2]; } }