@@ -208,8 +208,8 @@ private static function decodeNumericSegment(
208208 if ($ threeDigitsBits >= 1000 ) {
209209 throw new FormatException ("Too many three digit bits " );
210210 }
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 ));
213213 $ result .= (self ::toAlphaNumericChar ($ threeDigitsBits % 10 ));
214214 $ count -= 3 ;
215215 }
@@ -222,7 +222,7 @@ private static function decodeNumericSegment(
222222 if ($ twoDigitsBits >= 100 ) {
223223 throw new FormatException ("Too many bits: $ twoDigitsBits expected < 100 " );
224224 }
225- $ result .= (self ::toAlphaNumericChar ($ twoDigitsBits / 10 ));
225+ $ result .= (self ::toAlphaNumericChar (intdiv ( $ twoDigitsBits, 10 ) ));
226226 $ result .= (self ::toAlphaNumericChar ($ twoDigitsBits % 10 ));
227227 } elseif ($ count == 1 ) {
228228 // One digit left over to read
@@ -263,7 +263,7 @@ private static function decodeAlphanumericSegment(
263263 throw new FormatException ("Not enough bits available to read two expected characters " );
264264 }
265265 $ nextTwoCharsBits = $ bits ->readBits (11 );
266- $ result .= (self ::toAlphaNumericChar ($ nextTwoCharsBits / 45 ));
266+ $ result .= (self ::toAlphaNumericChar (intdiv ( $ nextTwoCharsBits, 45 ) ));
267267 $ result .= (self ::toAlphaNumericChar ($ nextTwoCharsBits % 45 ));
268268 $ count -= 2 ;
269269 }
0 commit comments