You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The definition for Base.:>>>, Base.:>> and Base.:<< do not compile to native shift instructions, because they need to handle the case where the integer is shifted by more than the integer bitwidth:
Often, this extra complication is not necessary, and it is possible to create a more effective bitshift operation by allowing overflow. This is completely analogous to how Base.:+ is more efficient than a saturating add, because it allows overflow:
I find myself using that pattern relatively often, but this bit-twiddling trick is a little obscure, so readers may not understand what the function is doing, and may not know that this trick is available.
It would be nice if Base provided these very basic operations for users interested in high performance bit-twiddling.
The text was updated successfully, but these errors were encountered:
The definition for
Base.:>>>
,Base.:>>
andBase.:<<
do not compile to native shift instructions, because they need to handle the case where the integer is shifted by more than the integer bitwidth:Often, this extra complication is not necessary, and it is possible to create a more effective bitshift operation by allowing overflow. This is completely analogous to how
Base.:+
is more efficient than a saturating add, because it allows overflow:I find myself using that pattern relatively often, but this bit-twiddling trick is a little obscure, so readers may not understand what the function is doing, and may not know that this trick is available.
It would be nice if Base provided these very basic operations for users interested in high performance bit-twiddling.
The text was updated successfully, but these errors were encountered: