-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Allow bitarray to handle shifts by a negative value #18154
Conversation
@eschnett Could you please verify that this does what you wanted? |
Is this merge-worthy? |
LGTM, though the merge commit should be squashed out (at merge time if needed) |
@test isequal(b1 >>> m, [ falses(m); b1[1:end-m] ]) | ||
@test isequal(b1 >>> -m, b1 << m) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe, for completeness, add a test for b1 >> -m
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
LGTM too. |
Also while you are at it, you could update the docs for shift operations (e.g. the doc for |
@rfourquet Not clear on how to update the docs. The docstrings for the shift operators are found in base/operators.jl, where the methods are defined for integer types. I don't want to change the signature of these functions (since they are specific to Integer). Can you clarify what I'm supposed to do here? |
I think it would be enough to attach additional docstrings to the shift methods acting on bitarrays. |
I'm bumping this - can we merge this as-is and deal with the docs later? Alternatively, can someone guide @dbeach24 through the process of adding the docstrings? |
I think it can, but would be nice to at least open a doc issue. |
replaced by #19760 |
Fix for #16706.
This allows left/right shifting a bitarray by a negative value.