jruby / jcodings

Java-based codings helper classes for Joni and JRuby
MIT License
20 stars 29 forks source link

Replace unsigned masks with toUnsigned method calls #54

Closed headius closed 2 years ago

headius commented 2 years ago

These masks are not descriptive and can easily get damaged when refactoring code or making minor changes. The JDK methods were added in Java 8 and perform the same operation, but with a descriptive method name.

x & 0xFF => Byte.toUnsignedInt(x) x & 0xFFFFFFFF => Integer.toUnsignedLong(x)

headius commented 2 years ago

Waiting on results of https://github.com/jruby/jruby/actions/runs/1993723361 to get more coverage.

headius commented 2 years ago

There's a failure or two in test:mri:core that also seems to be there without these changes (based on current jcodings master) so I think this change is fine.