I've got a series of bits, represented by pointers.
Bit* bits[32];
Now I need to implement the binary right rotate operator. I've got that the first part is a right shift of the same amount, which deals with all the bits which did not wrap around, but I'm not sure what to do about the ones which do wrap around.
How can I determine which bits end up in which positions in the end results?
So far, I've got
ExpressionHolder rotate(unsigned int other) const {
ExpressionHolder out;
out.e = new Expression;
for(int i = 0; i < (32 - other); i++) {
out.e->bits[i] = e->bits[i + other];
}
for(int i = (32 - other); i < 32; i++) {
out.e->bits[i] = e->bits[31 - i];
}
return out;
}
Is this correct?
float- no matter what shit you write, you always get afloatback out and if the answer isn't what it should be, good luck working out why.