| Contents | Index |
c = bitsrl(a, k)
c = bitsrl(a, k) returns the value of a shifted right logical by k bits.
The input operand a can be a built-in integer or a fi object with a fixed-point data type. For fixed-point operations, the OverflowMode and RoundMode properties are ignored. bitsrl operates on both signed and unsigned inputs and does not check overflow or underflow. bitsrl shifts zeros into the positions of bits that it shifts right.
k is a nonnegative, integer-valued constant.
a and c have the same associated fimath and numerictype objects.
This example shows how to shift bits using the bitsrl function. Consider the following signed fixed-point fi object with a value of -8, word length 4, and fraction length 0:
a = fi(-8,1,4,0); disp(bin(a)) 1000
Shift a right by one bit:
disp(bin(bitsrl(a,1))) 0100
bitsrl shifts a zero into the position of the bit that it shifts right.
The bitsrl function also supports built-in integer inputs. The following example shows the uint8 input being shifted right by two bits:
x = uint8(64); bitsrl(x,2) ans = 16
bitconcat | bitrol | bitror | bitshift | bitsliceget | bitsll | bitsra | pow2

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-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |