$x = Math::BigInt->bstr( $bigint ); $bits = int( log( $x ) / log( 2 ) ) + 1;