bits | [31 - 17] | [16] - 3 | 2 | 1 | 0 |
value | [reserved] | index | TI | IDT | EXT |
I know how to get the values of the EXT, IDT and TI flags but not how to get the value of the 'index' in the middle. It could be either 16 - 3 or 32 - 3 bits in width. I need to cut off the EXT, IDT and TI flags and then get the value of the reserved part and the index part.
How can I do this? I'm guessing I need to do some bit shifting but I don't know how.
I've tried this: uint32 index = (errorcode >> 3);
but I don't know if it will get the right value (and I don't know what the right value is, so reverse engineering won't work).
// keeps the reserved bits:
uint32 index = (errorcode >> 3); // gets bits 3-31 and makes them zero based
// if you want to drop the reserved bits:
index = (errorcode >> 3) & 0x1FFF;