Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UInt128 shift implementation doesn't match Kotlin implementation #53

Closed
mattmook opened this issue Jun 11, 2024 · 0 comments · Fixed by #54
Closed

UInt128 shift implementation doesn't match Kotlin implementation #53

mattmook opened this issue Jun 11, 2024 · 0 comments · Fixed by #54

Comments

@mattmook
Copy link
Member

Documentation for ULong's shl and shr says:

Note that only the six lowest-order bits of the bitCount are used as the shift distance. The shift distance actually used is therefore always in the range 0..63.

Currently the UInt128 implementation will shift with n >= 128 which will always result in a return value of zero. The ULong implementation looks as though it only shifts by n mod ULong.SIZE_BITS

@mattmook mattmook changed the title UInt128 shift implementation doesn't match Kotlin style implementation UInt128 shift implementation doesn't match Kotlin implementation Jun 11, 2024
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 a pull request may close this issue.

1 participant