Briefly explain bitwise rotation

Systems Architecture
7th Edition
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Stephen D. Burd
Chapter8: Data And Network Communication Technology
Section: Chapter Questions
Problem 34VE
Question

Briefly explain bitwise rotation

Expert Solution
BIT ROTATION:

Bit operation is also called a circular shift. This is an operation that is similar to shift but the bits that are at one end are put back to the other end.

This operation will move the bits of the binary object.

OPERATOR USAGE
<< This indicates that the bits are to be shifted to the left.
>> This indicates that the bits are to be shifted to the right.

 

 

 

EXAMPLE:

Consider opr has a value 16.

The bit pattern in 8-bit format is 00010000

So, we will specify the operation as opr << 2

The left operand (opr) specifies the value to be shifted.

The right operand (2) specifies the number of bits the pattern is needed to be shifted.

Both the operands are of the same precedence and are left-to-right associative.

The operands are of int or enum datatype. The operation is performed and the right operand will be converted to the data type int. So, the result will the same type as the left operand.

NOTE:

The right operand should not have a negative value.

The right operand should not be greater than or equal to the width of the bit that is being shifted.

 

steps

Step by step

Solved in 4 steps

Blurred answer
Knowledge Booster
Concept of Light
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Systems Architecture
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning