I am not the best when it comes down to bitwise functions but I want to figure out how this works. Once I figure out how this works I can probably figure out the rest.
ori r11, r11, 11
How could that be translated into C? Am I doing it right?
r11 = (r11 | 11);
I know that isn't proper C syntax, I just want a basic understanding of it.
The ori
instruction is or immediate: ori RA RS UI
where:
RA = the resulting register to store the operation result
RS = the source register for which to use in the operation
UI is an unsigned 16-bit integer for the operation
You have interpreted it correctly, and your C looks valid as well.
Be aware though, that PowerPC is a big-endian architecture, so if you're planning on comparing any data across platforms that aren't big-endian (such as Intel x86 for example), you will not get the correct results. The syntax doesn't change, the position of the "lower order bits" will.