| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Fixed-Point Toolbox |
| Contents | Index |
| Learn more about 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 | ![]() |

Learn how to apply early verification to your development process through these technical resources.
How much time do you spend on testing to ensure implementation meets system-level requirements?
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |