This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Bit shift right logical


c = bitsrl(a, k)



c = bitsrl(a, k) returns the result of a logical right shift by k bits on input a for fixed-point operations. bitsrl shifts zeros into the positions of bits that it shifts right. It does not check overflow or underflow.

bitsrl ignores fimath properties such as RoundingMode and OverflowAction.

When a is a fi object, a and c have the same associated fimath and numerictype objects.


collapse all

Shift a signed fi input right by 1 bit.

Create a signed fixed-point fi object with a value of -8, word length 4, and fraction length 0 and display its binary value.

a = fi(-8,1,4,0);

Shift a right by 1 bit, and display the binary value.


bitsrl shifts a zero into the position of the bit that it shifts right.

Shift right a built-in int8 input using a fi shift value.

k = fi(2);
a = int8(64);
ans = int8

Use bitsrl to shift a uint8 input right by 2 bits.

a = uint8(64);
ans = uint8

Input Arguments

collapse all

Data that you want to shift, specified as a scalar, vector, matrix, or multidimensional array.

Data Types: fi | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

Complex Number Support: Yes

Number of bits to shift, specified as a non-negative integer-valued scalar.

Data Types: fi|single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

Extended Capabilities

Introduced in R2007b