I want to find the value of a byte in a large integer. For example the number
11973777 = 10110110 10110100 10010001
I would like to find that
11973777[2] = 10110110 = 182
11973777[1] = 10110100 = 180
11973777[0] = 10010001 = 145
And do so efficiently(bitwise operations). I can easily find the value of a bit at any position in the number with a bitwise operation but I don’t want to do that 8 times just to get the byte, or shift left then shift right. This is tagged as javascript because I am doing it in javascript but I suppose bitwise operations can be translated. Thank you in advance for any help you can lend.
To a certain extent, you have to bit-shift:
But you can always package the logic in a function to make it more convenient, like: