This is documentation for Mathematica 7, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)

BitShiftRight

BitShiftRight[n, k]
shifts the binary bits in the integer n to the right by k places, dropping bits that are shifted past the unit's position on the right.
BitShiftRight[n]
shifts one bit to the right.
  • Negative values of k shift to the left.
Shift 3 places to the right:
Shift 7 places to the right, leaving no nonzero bits:
Shift 3 places to the right:
In[1]:=
Click for copyable input
Out[1]=
Shift 7 places to the right, leaving no nonzero bits:
In[2]:=
Click for copyable input
Out[2]=
BitShiftRight works with numbers of any size:
BitShiftRight automatically threads itself over lists:
New in 6