I know the best way to divide a number by 2 is to move one bit to the left. What do I do if I am dividing by a multiple of 2 (for example 8), do I move over by 3 bits, here are my questions:
- How can I do such operations in C++, bit movement?
- How can I access higher byte of an int and lower byte of an int, if I wanted to swap their values?
I know these operations can be done at the assembly level because we are dealing with registers, I just don't know if we have access to such things in C++.