Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to implement bitwise ROTATION in C

Status
Not open for further replies.

CM600

Member level 3
Joined
Jan 26, 2004
Messages
63
Helped
3
Reputation
6
Reaction score
1
Trophy points
1,288
Location
BG
Activity points
556
bit rotation in c

Hello,
I am using IAR ARM C compiler, is there a library function for rol or ror ?
 

c bit rotation

Hi CM600,

You can try << for rol and >> for ror.

regrads,
 

c bit rotate

hi!
u caneasily do it by using of bitwise operators.

rag_perfect
 

bitwise rotate c

The >> and << operators are for shifting not for rotation
 

bitwise rotation in c

to rotate a byte by n bits to the right:

a = (a >> n) || (a << (8-n))

you probably want to make your code more general (don't hardcode '8').
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top