MATLAB Functions | Help Desk |
bitshift
Bit-wise shift
C = bitshift(A,n)
C = bitshift(A,n)
returns the value of A
shifted by n
bits. If n>0
, this is same as a multiplication by 2
n
(left shift). If n<0
, this is the same as a division by 2
n (right shift). A
must be a nonnegative integer, which you can ensure by using the ceil
, fix
, floor
, and round
functions.
Shifting 1100 (12, decimal) to the left two bits yields 110000 (48, decimal).
C = bitshift(12,2) C = 48
bitand
Bit-wise AND
bitcmp
Complement bits
bitget
Get bit
bitmax
Maximum floating-point integer
bitor
Bit-wise OR
bitset
Set bit
bitxor
Bit-wise XOR