Hi guys!
I'm working on a random generator package and want to ask, whether it's
possible to generate a type like Int, that can have different sizes at
runtime.
Motivation:
The package ships to generators, one for 32 (lets name it MyGen32) and
one for 64 bits (MyGen64). As it is not good for
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
Hi,
maybe you have already considered this and dropped it out for whenever
reasons. Anyways, what if you stick with Int or Data.Word.Word types and use
Data.Bits.bitSize or maxBound to check in runtime what the word size is. It
might be easier than using CPP extension.
~dsouza
On Sun, Jan 2,