I'm dealing with cache questions and there I need to split the address into tag/set/offset. For example I have the address 0xFFFFFE7D6C5B4333 and for example the offset contains 5 bits (The offset is the first block from the right of the address). Then I would have to convert the hex address into binary, remove the first 5 bits and convert it back to hex. This process could take some time and it can lead to some mistakes. If the number of the offset bits was of format 4*c then it could be easy because I would just remove the first right c numbers from the hex code.
Is there a better way to do it when the number of the offset bits is not of format 4*c (for example 5)?
For example for 0xFFFFFE7D6C5B4333 we get:
1111 1111 1111 1111 1111 1110 0111 1101 0110 1100 0101 1011 0100 0011 0011 0011
We remove the first five bits and we get:
1111 1111 1111 1111 1111 1110 0111 1101 0110 1100 0101 1011 0100 0011 001
Back to hex: 0x7FFFFF3EB62DA19