If you can access process_bits() without considering RevIn value, you will likely not get the CRC value you're expecting! Put RevIn check where it belongs, in process_bits().
Has some more efficient code, commented out because I was having trouble getting it to work. However, it may have been due to the particular data I was trying to decode and CRC-validate.