bitror - Bitwise rotate right

Syntax

c = bitror(a, k)

Description

c = bitror(a, k) returns the value of the fi object a rotated right 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. bitror operates on both signed and unsigned fixed point inputs and does not check overflow or underflow. bitror rotates bits from the LSB side into the MSB 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.

Example

This example shows how to rotate the bits of a fi object right. Consider the following unsigned fixed-point fi object with a value 5, word length 4, and fraction length 0:

a = fi(5,0,4,0);
disp(bin(a))

0101

Rotate a right one bit:

disp(bin(bitror(a,1)))

1010

Rotate a right two bits:

disp(bin(bitror(a,2)))

0101

See Also

bitconcat, bitrol, bitshift, bitsliceget, bitsll, bitsra, bitsrl

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS