Skip to content

Commit

Permalink
Fix #60
Browse files Browse the repository at this point in the history
  • Loading branch information
paragonie-security committed Jan 30, 2018
1 parent 74e0234 commit ca9d065
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/Core/Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ public static function load64_le($string)
'String must be 4 bytes or more; ' . self::strlen($string) . ' given.'
);
}
if (PHP_VERSION_ID >= 50603) {
if (PHP_VERSION_ID >= 50603 && PHP_INT_SIZE === 8) {
/** @var array<int, int> $unpacked */
$unpacked = unpack('P', $string);
return (int) $unpacked[1];
Expand Down Expand Up @@ -651,13 +651,13 @@ public static function store64_le($int)
throw new TypeError('Argument 1 must be an integer, ' . gettype($int) . ' given.');
}
}
if (PHP_VERSION_ID >= 50603) {
/** @var string $packed */
$packed = pack('P', $int);
return $packed;
}

if (PHP_INT_SIZE === 8) {
if (PHP_VERSION_ID >= 50603) {
/** @var string $packed */
$packed = pack('P', $int);
return $packed;
}
return self::intToChr($int & 0xff) .
self::intToChr(($int >> 8) & 0xff) .
self::intToChr(($int >> 16) & 0xff) .
Expand Down

0 comments on commit ca9d065

Please sign in to comment.