The usual mechanism would be to just bundle a pair of foreign functions and a fallback purely functional implementation.<div><br></div><div>I&#39;ll see about packaging up a Data.Bits.DeBruijn module somewhere with few if any dependencies.</div>
<div><br></div><div>-Edward<br><div><br></div><div><div><div><div class="gmail_quote">On Mon, Sep 19, 2011 at 8:25 AM, Joachim Breitner <span dir="ltr">&lt;<a href="mailto:mail@joachim-breitner.de">mail@joachim-breitner.de</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi,<br>
<br>
Am Sonntag, den 18.09.2011, 18:46 -0400 schrieb Edward Kmett:<br>
<div class="im">&gt; You can use a smaller DeBruijn multiplication table to handle 32 bits,<br>
&gt; but the one that I gave puts the answer in the most significant 6 bits<br>
&gt; of a 64 bit word, so if you use it with a 32 bit word, they&#39;ll be<br>
&gt; setting bits you don&#39;t have and all answers will be 0.<br>
<br>
</div>I’m not sure how to cleanly select the right implementation inside<br>
Data.IntMap. Also, we have architectures with 31 bit words (s390, at<br>
least). If anything, then the functions ought to move into the Bits type<br>
class and into GHC.Word. There it makes also more sense to select<br>
architecture-specific implementations, e.g. the primitive operation on<br>
x86.<br>
<div class="im"><br>
&gt; Also, if you don&#39;t care about the particular order in which you visit<br>
&gt; the bits you could store the bits in a different order in the Word(64)<br>
&gt; than you would if you just set them directly by preshuffling them.<br>
<br>
</div>The order is unfortunately relevant, and I am not sure I have a use for<br>
an arbitrarily ordered fold.<br>
<br>
Greetings,<br>
<div><div></div><div class="h5">Joachim<br>
<br>
<br>
--<br>
Joachim &quot;nomeata&quot; Breitner<br>
  <a href="mailto:mail@joachim-breitner.de">mail@joachim-breitner.de</a>  |  <a href="mailto:nomeata@debian.org">nomeata@debian.org</a>  |  GPG: 0x4743206C<br>
  xmpp: <a href="mailto:nomeata@joachim-breitner.de">nomeata@joachim-breitner.de</a> | <a href="http://www.joachim-breitner.de/" target="_blank">http://www.joachim-breitner.de/</a><br>
<br>
</div></div><br>_______________________________________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org">Libraries@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/libraries" target="_blank">http://www.haskell.org/mailman/listinfo/libraries</a><br>
<br></blockquote></div><br></div></div></div></div>