Skip to content

Commit

Permalink
Merge pull request #24 from merbaum/master
Browse files Browse the repository at this point in the history
bcmod cast to int for compatibility php 72
  • Loading branch information
stephen-hill authored Aug 22, 2019
2 parents d6714d5 + 2c8cbe6 commit bd9fc19
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/BCMathService.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function encode($string)
$output = '';
while ($decimal >= $this->base) {
$div = bcdiv($decimal, $this->base, 0);
$mod = bcmod($decimal, $this->base);
$mod = (int) bcmod($decimal, $this->base);
$output .= $this->alphabet[$mod];
$decimal = $div;
}
Expand Down Expand Up @@ -146,7 +146,7 @@ public function decode($base58)
// Convert from base10 to base256 (8-bit byte array)
$output = '';
while ($decimal > 0) {
$byte = bcmod($decimal, 256);
$byte = (int) bcmod($decimal, 256);
$output = pack('C', $byte) . $output;
$decimal = bcdiv($decimal, 256, 0);
}
Expand Down

0 comments on commit bd9fc19

Please sign in to comment.