S
Shawn B.
Greetings,
I am simulating an assembly language bit rotation in C# and it works
wonderfully
---------
....
public uint Value;
....
public uint RotateRight(byte count) {
Value = ((Value >> count) | (Value << (32-count)));
return Value;
}
---------
as long is the value is 32-bit or 64-bit (because of a limitation of the
shift operator). I need it to work on an 8-bit or 16-bit value, as well. I
presume I'd have to have knowledge of the intended size of the value and do
the shift and move the bit and the 0 or 7, or 0 or 15 bit position and clear
the extra bits if there are any. That seems like a lot of work.
Is there a way to simulate an 8 or 16-bit rotate with a 32-bit or 64-bit
value?
Thanks,
Shawn
I am simulating an assembly language bit rotation in C# and it works
wonderfully
---------
....
public uint Value;
....
public uint RotateRight(byte count) {
Value = ((Value >> count) | (Value << (32-count)));
return Value;
}
---------
as long is the value is 32-bit or 64-bit (because of a limitation of the
shift operator). I need it to work on an 8-bit or 16-bit value, as well. I
presume I'd have to have knowledge of the intended size of the value and do
the shift and move the bit and the 0 or 7, or 0 or 15 bit position and clear
the extra bits if there are any. That seems like a lot of work.
Is there a way to simulate an 8 or 16-bit rotate with a 32-bit or 64-bit
value?
Thanks,
Shawn