print_hex() is really slow on that! Something faster would be great!
The whole piece doesn't make a lot of sense to me, with all the left shifting + right shifting involved. If you can articulate what you are trying to do, people may be able to better help you.