[Haskell-cafe] Defining a type depending on the word size of platform
Daniel Fischer
daniel.is.fischer at googlemail.com
Sun Jan 2 14:16:17 CET 2011
On Sunday 02 January 2011 13:45:13, Robert Clausecker wrote:
>
> I guess the easiest way would be to use CPP, but is there any flag for
> the wordsize?
Not directly, but I think
{-# LANGUAGE CPP #-}
#include "MachDeps.h"
#if WORD_SIZE_IN_BITS == 32
type MyGen = MyGen32
#else // GHC only works with 32- and 64-bit words
type MyGen = MyGen64
#endif
should do it.
MachDeps.h ties you to GHC of course, if you want it to work on other
compilers too, I guess you need a configure script.
More information about the Haskell-Cafe
mailing list