Using shifts and bit tests makes the code unnecessarily annoying to reason about. I'm replacing it with subtracting from 3 to translate the bit order from the PowerPC format to the usual format.