aboutsummaryrefslogtreecommitdiff
path: root/php/src/Google/Protobuf/Internal/InputStream.php
diff options
context:
space:
mode:
authorBrent Shaffer <betterbrent@google.com>2017-06-14 15:57:11 -0700
committerPaul Yang <TeBoring@users.noreply.github.com>2017-06-14 15:57:11 -0700
commitb9b34e9b1167d89c4df8f0abffe31262aebe7a39 (patch)
tree90bd518f966f24ea48fe2472e68409868501abfa /php/src/Google/Protobuf/Internal/InputStream.php
parent09d2994b1f68160508d9188f9bdb1a2a3b527e1e (diff)
downloadprotobuf-b9b34e9b1167d89c4df8f0abffe31262aebe7a39.tar.gz
protobuf-b9b34e9b1167d89c4df8f0abffe31262aebe7a39.tar.bz2
protobuf-b9b34e9b1167d89c4df8f0abffe31262aebe7a39.zip
Follows proper autoloading standards (#3123)
* Follows proper autoloading standards - Splits PHP classes in descriptor.php into separate files - Splits MapFieldIter and RepeatedFieldIter into separate files - Moves descriptor.php to Internal/functions.php - Moves all namespaced functions into Iternal/functions.php * fixes Makefile.am for added php files * [PHP] moves all functions to GPBUtil * removes description.php from the makefile
Diffstat (limited to 'php/src/Google/Protobuf/Internal/InputStream.php')
-rw-r--r--php/src/Google/Protobuf/Internal/InputStream.php25
1 files changed, 2 insertions, 23 deletions
diff --git a/php/src/Google/Protobuf/Internal/InputStream.php b/php/src/Google/Protobuf/Internal/InputStream.php
index 8012a225..f84e1aee 100644
--- a/php/src/Google/Protobuf/Internal/InputStream.php
+++ b/php/src/Google/Protobuf/Internal/InputStream.php
@@ -34,27 +34,6 @@ namespace Google\Protobuf\Internal;
use Google\Protobuf\Internal\Uint64;
-function combineInt32ToInt64($high, $low)
-{
- $isNeg = $high < 0;
- if ($isNeg) {
- $high = ~$high;
- $low = ~$low;
- $low++;
- if (!$low) {
- $high++;
- }
- }
- $result = bcadd(bcmul($high, 4294967296), $low);
- if ($low < 0) {
- $result = bcadd($result, 4294967296);
- }
- if ($isNeg) {
- $result = bcsub(0, $result);
- }
- return $result;
-}
-
class InputStream
{
@@ -192,7 +171,7 @@ class InputStream
$count += 1;
} while ($b & 0x80);
- $var = combineInt32ToInt64($high, $low);
+ $var = GPBUtil::combineInt32ToInt64($high, $low);
} else {
$result = 0;
$shift = 0;
@@ -265,7 +244,7 @@ class InputStream
}
$high = unpack('V', $data)[1];
if (PHP_INT_SIZE == 4) {
- $var = combineInt32ToInt64($high, $low);
+ $var = GPBUtil::combineInt32ToInt64($high, $low);
} else {
$var = ($high << 32) | $low;
}