-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
shr performs an arithmetic right shift on signed integers, and a logical right shift on unsigned integers.
(1) While the documentation is clear for signed integers, the behavior for unsigned integers isn't specified. This would be easy enough to fix in documentation.
(2) ashr makes sense in this context, as it is an explicit arithmetic right shift, supported only on signed integers. It's weird that it can't be called as an operator.
(3) It would be really cheap to add an lshr operator that only applies to unsigned integers for consistency.
(4) Of course it would be nice for ashr to also support signed integers, and the proposed lshr to also support signed integers
Not saying anything yet about who would shoulder the implementation burden, I just wanted to check if there is agreement on the status and what would be desirable and/ or easy.
Note: previous version removed, as it was based on incorrect understanding.