Am 25.08.2011 um 19:57 schrieb Andrew Coppin:

Is there a way to actually determine how many bits are in an Integer?


occupiedBits :: Integer -> Int
occupiedBits = (+1) . truncate . logBase 2 . (+1)

Caveat: untested :-)

Cheers,

Gabor