Simplify decoding logic every so slightly by replacing lookup table with some bit fiddling.