[Haskell-cafe] containers license issue

Clark Gaebel cgaebel at uwaterloo.ca
Wed Dec 12 17:47:35 CET 2012


Just for reference:

In Data/IntMap/Base.hs

highestBitMask :: Nat -> Nat
highestBitMask x0
  = case (x0 .|. shiftRL x0 1) of
     x1 -> case (x1 .|. shiftRL x1 2) of
      x2 -> case (x2 .|. shiftRL x2 4) of
       x3 -> case (x3 .|. shiftRL x3 8) of
        x4 -> case (x4 .|. shiftRL x4 16) of
#if !(defined(__GLASGOW_HASKELL__) && WORD_SIZE_IN_BITS==32)
         x5 -> case (x5 .|. shiftRL x5 32) of   -- for 64 bit platforms
#endif
          x6 -> (x6 `xor` (shiftRL x6 1))

In FXT bithigh.h:

static inline ulong highest_one(ulong x)
// Return word where only the highest bit in x is set.
// Return 0 if no bit is set.
{
#if defined  BITS_USE_ASM
    if ( 0==x )  return 0;
    x = asm_bsr(x);
    return  1UL<<x;
#else
    x = highest_one_01edge(x);
    return  x ^ (x>>1);
#endif  // BITS_USE_ASM
}

And in FXT bits/bithigh-edge.h:

static inline ulong highest_one_01edge(ulong x)
// Return word where all bits from (including) the
//   highest set bit to bit 0 are set.
// Return 0 if no bit is set.
//
// Feed the result into bit_count() to get
//   the index of the highest bit set.
{
#if defined  BITS_USE_ASM

    if ( 0==x )  return 0;
    x = asm_bsr(x);
    return  (2UL<<x) - 1;

#else  // BITS_USE_ASM

    x |= x>>1;
    x |= x>>2;
    x |= x>>4;
    x |= x>>8;
    x |= x>>16;
#if  BITS_PER_LONG >= 64
    x |= x>>32;
#endif
    return  x;
#endif  // BITS_USE_ASM
}

=====

However... I think the easy solution for this is to just find this in
http://graphics.stanford.edu/~seander/bithacks.html, and cite it instead. I
looked briefly and couldn't find it, but I'm almost sure it's in there.

  - Clark


On Wed, Dec 12, 2012 at 11:37 AM, Niklas Larsson <metaniklas at gmail.com>wrote:

> 2012/12/12 David Thomas <davidleothomas at gmail.com>:
> > Ah, that's more than we'd been told.  If that is the case, then
> containers
> > is in violation of the GPL (unless they got permission to copy that code,
> > separately), and either must obtain such permission, be relicensed,
> > remove/replace that code.
>
> I think it's just a confusion of language, the "derived" algorithm
> clashes uncomfortably with the lawyerly "derived work". They are not
> used in the same sense.
>
> Niklas
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20121212/f50a3354/attachment.htm>


More information about the Haskell-Cafe mailing list