Rotate left
Posted: Thu Nov 12, 2015 5:04 pm
Is there a C-code for rotate left and rotate right?
Old forums - please visit https://www.flowcode.co.uk/forums
https://www.flowcode.co.uk/mmforums/
Code: Select all
var = var >> 1;Code: Select all
count = 0;
while (count < shiftcount)
{
bitsave = var & 0x01;
var = var >> 1;
if (bitsave == 0x01)
var = var | 0x80;
count = count + 1;
}Code: Select all
count = 0;
while (count < shiftcount)
{
bitsave = var & 0x80;
var = var << 1;
if (bitsave == 0x80)
var = var | 0x01;
count = count + 1;
}