Skip to content

Conversation

@headius
Copy link
Member

@headius headius commented Mar 16, 2022

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)

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 headius added this to the 1.0.56 milestone Mar 16, 2022
@headius
Copy link
Member Author

headius commented Mar 16, 2022

@headius
Copy link
Member Author

headius commented Mar 16, 2022

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.

@headius headius merged commit 5e0bccc into jruby:master Mar 16, 2022
@headius headius deleted the to_unsigned branch March 16, 2022 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant