On Sun, Sep 4, 2011 at 11:22 AM, John Carr <[email protected]> wrote:
>
> I am working with a file format the contains 32 bit integers.
> I need to use int32 on 32 bit systems.  I would like to use plain
> integers, unboxed and with native machine operations, on 64 bit
> systems.
>
> Is there any way to convince ocamlopt to choose between int and
> int32 representations _at compile time_?
>

You may be able to use ideas/implementation from the Int63 module:

http://people.redhat.com/~rjones/virt-df/html/Int63.html
or
http://www.janestreet.com/ocaml/janestreet-ocamldocs/core/Int63.html

The Int63 module uses int internally on 64bit OCaml installations and
Int64.t internally on 32bit OCaml installations.  I am not familiar
with the details but it may be adaptable to your needs.

Hez


-- 
Caml-list mailing list.  Subscription management and archives:
https://sympa-roc.inria.fr/wws/info/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Reply via email to