[Haskell-cafe] clz / bsr functions on Integer
claude at mathr.co.uk
Sat Nov 13 11:08:10 UTC 2021
On 13/11/2021 00:13, james faure wrote:
> Why is there no `countLeadingZeros` function for Integer? This seems
> particularly strange because gmp provides
> /mp_bitcnt_t/*mpz_scan0*/(const mpz_top, mp_bitcnt_tstarting_bit)/
Integer is not always implemented with GMP.
> More importantly, what is the recommended way to access it?
If you do have an Integer implemented with GMP (the default case with
GHC), you can use one of
See the example at the top of that module page.
More information about the Haskell-Cafe