
Hi, Does anyone knows of a nice implementation of bit vectors? I like the functions I see in Data.Bits (rotate, shift etc.), but that only works with predefined sizes and I need a bit vector of exactly 33 bits. Thanks, Maurício

On Sat, Nov 25, 2006 at 10:41:56AM -0200, Maurício wrote:
Does anyone knows of a nice implementation of bit vectors? I like the functions I see in Data.Bits (rotate, shift etc.), but that only works with predefined sizes and I need a bit vector of exactly 33 bits.
Unboxed arrays (UArray, IOUArray, STUArray) of Bools work just like a bit vector, with 8 elements packed in one byte. Best regards Tomasz

Hello Tomasz, Saturday, November 25, 2006, 5:13:55 PM, you wrote:
On Sat, Nov 25, 2006 at 10:41:56AM -0200, Maurício wrote:
Does anyone knows of a nice implementation of bit vectors? I like the functions I see in Data.Bits (rotate, shift etc.), but that only works with predefined sizes and I need a bit vector of exactly 33 bits.
Unboxed arrays (UArray, IOUArray, STUArray) of Bools work just like a bit vector, with 8 elements packed in one byte.
they don't support rotate/shift operations. i think it's better to implement this himself using Word64 -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com

On Sat, Nov 25, 2006 at 10:41:56AM -0200, Maur??cio wrote:
Does anyone knows of a nice implementation of bit vectors? I like the functions I see in Data.Bits (rotate, shift etc.), but that only works with predefined sizes and I need a bit vector of exactly 33 bits.
Check out http://darcs.brianweb.net/hsutils/src/Brianweb/Word.lhs It supports typesafe (and efficient) operations on words of any bit length (including 33-bits). You can also safely split and join words. The type system ensures concatenating a Word16 and a Word32 results in a Word48, etc. -Brian
participants (4)
-
Brian Alliet
-
Bulat Ziganshin
-
Maurício
-
Tomasz Zielonka