Using a bitshift with a shift larger than the limb bitwidth doesn't work
aldogunsing-rl opened this issue · 2 comments
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.
Have you tried with UBSan enabled?
Currently,
shift_right
(and probablyshift_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 ;-)