[Haskell-cafe] Looking for smallest power of 2 >= Integer

Dan Piponi dpiponi at gmail.com
Mon Dec 3 23:36:32 EST 2007

Is there anything in any of the interfaces to Integer that will allow
me to quickly find the highest bit set in an Integer? If not, does
anyone have any recommendations for how to do it efficiently. There
are some obvious things that come to mind but which might involve
quite a bit of useless copying of data internally by the
implementation of Integer.

More information about the Haskell-Cafe mailing list