stefanor at cox.net
Mon Aug 13 18:27:36 EDT 2007
On Mon, Aug 13, 2007 at 03:21:54PM -0700, John Meacham wrote:
> On Sat, Aug 11, 2007 at 12:09:44PM -0300, Isaac Dupree wrote:
> > BTW: I estimate that it took me about two solid weeks of time, more than
> > I had originally intended to spend :)
> > I think using CPP will prove important, but makes it harder to test in
> > Hugs... should I use Cabal if I want to use Hugs with haskell+cpp code?
> I think if you were willing to use what is provided by the FFI
> extension, you could make some signifigant improvements without
> resorting to CPP. mainly, you could use unsigned arithmetic and have
> access to bit operations.
> I was thinking a representation like
> data Integer = Integer !Bool Rest
> data Rest = Digit !Word Rest | End
> where the Bool indicates the sign, and the rest are the base-wordsize
> digits. It would also be possible to just use a sign bit in the number
> of course. that unboxed strict Word should make a big difference.
You might also try
data Integer = Pos !Word | Neg !Word | Big !Word Integer
since the incremental penalty of 3 constructors is quite small, and it
eliminates a few indirections.
(Note: You have to actually specify -funbox-strict-fields for the ! to
do much good.)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: Digital signature
Url : http://www.haskell.org/pipermail/libraries/attachments/20070813/5864f471/attachment.bin
More information about the Libraries