| Fixed-Point Toolbox™ | ![]() |
c = bitrol(a, k)
c = bitrol(a, k) returns the value of the fi object a rotated left by k bits.
a can be a scalar fi object or a vector fi object. It can be any fixed-point numeric type. The OverflowMode and RoundMode properties are ignored. bitrol operates on both signed and unsigned fixed point inputs and does not check overflow or underflow. bitrol rotates bits from the MSB side into the LSB side.
k is an integer constant that must be greater than zero. k can be greater than the word length of a. It is always normalized to mod(a.WordLength,k).
a and c have the same fimath and the numerictype objects.
This example shows how to rotate the bits of a fi object left. Consider the following unsigned fixed-point fi object with a value of 10, word length 4, and fraction length 0:
a = fi(10,0,4,0); disp(bin(a)) 1010
Rotate a left one bit:
disp(bin(bitrol(a,1))) 0101
Rotate a left two bits:
disp(bin(bitrol(a,2))) 1010
bitconcat, bitror, bitshift, bitsliceget, bitsll, bitsra, bitsrl
![]() | bitreplicate | bitror | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |