in reply to Efficient bit-twiddling in Perl.
This is more about the source of your input (32bit) stream. If it just (0..2**32) and then repeat, then you look like you have the solution now.
But if the input stream is being generated from an analog or digital source and the encoding could have repetition, then using 'memorize' or caching the results in a hash might give you some additional performance.
I once saw an IBM demo that compressed 1 minute of full color video of a football game unto a 360K floppy. IBM's explanation was that so much of the data was repetitious that only the differences from frame to frame was being saved on the floppy.
Just a thought...Ed
"Well done is better than well said." - Benjamin Franklin