Skip to content

Commit cbe54bc

Browse files
committed
GMP has shift overloads too
1 parent bd72474 commit cbe54bc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/Utility/BigIntegerGmp.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,14 @@ public function toPower($b)
113113
public function shiftRight($bits=8)
114114
{
115115
$ret = new self();
116-
$ret->_rh = gmp_div($this->_rh, gmp_init(2) ** $bits);
116+
$ret->_rh = $this->_rh >> $bits;
117117
return $ret;
118118
}
119119

120120
public function shiftLeft($bits=8)
121121
{
122122
$ret = new self();
123-
$ret->_rh = gmp_mul($this->_rh, gmp_init(2) ** $bits);
123+
$ret->_rh = $this->_rh << $bits;
124124
return $ret;
125125
}
126126

0 commit comments

Comments
 (0)