Since at the end you have to use an AND anyway to cut off the 2 flag-bits you could use a negative offset of 8 bits and mask 10 bits of a 2**5=32 bit vec without loss of speed!
Flags
01234567|FF|ddddddddddddddddddddd 32 bit Vector
-8 bits | | 22 bits Data
00000000|00|111111111111111111111 Mask