[Haskell-cafe] containers license issue

Johan Tibell johan.tibell at gmail.com
Wed Dec 12 19:54:47 CET 2012


On Wed, Dec 12, 2012 at 10:40 AM, Clark Gaebel <cgaebel at uwaterloo.ca> wrote:
> I just did a quick derivation from
> http://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2 to get
> the highest bit mask, and did not reference FXT nor the containers
> implementation. Here is my code:
>
> highestBitMask :: Word64 -> Word64
> highestBitMask x1 = let x2 = x1 .|. x1 `shiftR` 1
>                         x3 = x2 .|. x2 `shiftR` 2
>                         x4 = x3 .|. x3 `shiftR` 4
>                         x5 = x4 .|. x4 `shiftR` 8
>                         x6 = x5 .|. x5 `shiftR` 16
>                         x7 = x6 .|. x6 `shiftR` 32
>                      in x7 `xor` (x7 `shiftR` 1)
>
> This code is hereby released into the public domain. Problem solved.

I will integrate this into containers later today.



More information about the Haskell-Cafe mailing list