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

Using a bitshift with a shift larger than the limb bitwidth doesn't work #55

Open
aldogunsing-rl opened this issue Sep 24, 2024 · 2 comments

Comments

@aldogunsing-rl
Copy link

Currently, shift_right (and probably shift_left as well) don't support a shift larger than the limb bitwidth and when used give an undefined result. It would be nice if this was supported, or at least checked so an error would be given whenever it is tried.

@johnmcfarlane
Copy link

Have you tried with UBSan enabled?

@niekbouman
Copy link
Owner

Currently, shift_right (and probably shift_left as well) don't support a shift larger than the limb bitwidth and when used give an undefined result. It would be nice if this was supported, or at least checked so an error would be given whenever it is tried.

Indeed. I have now clarified this in the inline documentation of those functions.

I could also add an assert statement to explicitly check this, but then consumers have to think of compiling with the NDEBUG flag in production builds. Would you prefer that?

BTW We do accept pull requests ;-)

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

No branches or pull requests

3 participants