in reply to Most Significant Set Bit
Thank you all for your time and insight on this interesting nugget. My approach is indeed a 6-step binary chop as hv suggested, and after taking in and considering everything you guys have said, it seems clear that while this is the most efficient logical concept, I am hard pressed to do it justice in pure Perl. A proper C implementation would bring very significant gains in speed and could even take advantage of possible hardware support ikegami spoke of.
If gcc has a builtin MSSB function, I have a mind to suggest that a future version of Perl could rock one. When we justifiably resort to bit twiddling, we are either trying to save memory, or optimize tight loops which iterate billions of times. In these cases, the best I can do in Perl (or might do in XS) would be glaringly inferior to a builtin function in both performance and maintainability.
I would be curious about the recommended path to go about delivering such a thing to the community, not to be an entitled freeloader or to lack initiative. I have to admit that if there were ever any significant interest in this function among Perl users I'd see evidence of that as a module that provides it. For whatever reason, some ideas just aren't very popular, and I accept that.
I understand there are many Perl functions which simply wrap C functions, and this seems almost like that. I would submit that while it may not be the most widely used feature, it may be a great addition, if it's no more difficult to implement.