@@ -208,8 +208,8 @@ private static function decodeNumericSegment(
208
208
if ($ threeDigitsBits >= 1000 ) {
209
209
throw new FormatException ("Too many three digit bits " );
210
210
}
211
- $ result .= (self ::toAlphaNumericChar ($ threeDigitsBits / 100 ));
212
- $ result .= (self ::toAlphaNumericChar ((( int ) round ( $ threeDigitsBits / 10 ) ) % 10 ));
211
+ $ result .= (self ::toAlphaNumericChar (intdiv ( $ threeDigitsBits, 100 ) ));
212
+ $ result .= (self ::toAlphaNumericChar (intdiv ( $ threeDigitsBits, 10 ) % 10 ));
213
213
$ result .= (self ::toAlphaNumericChar ($ threeDigitsBits % 10 ));
214
214
$ count -= 3 ;
215
215
}
@@ -222,7 +222,7 @@ private static function decodeNumericSegment(
222
222
if ($ twoDigitsBits >= 100 ) {
223
223
throw new FormatException ("Too many bits: $ twoDigitsBits expected < 100 " );
224
224
}
225
- $ result .= (self ::toAlphaNumericChar ($ twoDigitsBits / 10 ));
225
+ $ result .= (self ::toAlphaNumericChar (intdiv ( $ twoDigitsBits, 10 ) ));
226
226
$ result .= (self ::toAlphaNumericChar ($ twoDigitsBits % 10 ));
227
227
} elseif ($ count == 1 ) {
228
228
// One digit left over to read
@@ -263,7 +263,7 @@ private static function decodeAlphanumericSegment(
263
263
throw new FormatException ("Not enough bits available to read two expected characters " );
264
264
}
265
265
$ nextTwoCharsBits = $ bits ->readBits (11 );
266
- $ result .= (self ::toAlphaNumericChar ($ nextTwoCharsBits / 45 ));
266
+ $ result .= (self ::toAlphaNumericChar (intdiv ( $ nextTwoCharsBits, 45 ) ));
267
267
$ result .= (self ::toAlphaNumericChar ($ nextTwoCharsBits % 45 ));
268
268
$ count -= 2 ;
269
269
}
0 commit comments