caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Hezekiah M. Carty" <hcarty@atmos.umd.edu>
To: John Carr <jfc@mit.edu>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Conditionally boxed 32 bit integers?
Date: Sun, 4 Sep 2011 13:28:27 -0400	[thread overview]
Message-ID: <CAMfPyLBmrQe47j1VPpTkq4n2zJ2ughC1zYyNaPH-nXxWGfUTSg@mail.gmail.com> (raw)
In-Reply-To: <201109041522.p84FM5DA001371@outgoing.mit.edu>

On Sun, Sep 4, 2011 at 11:22 AM, John Carr <jfc@mit.edu> 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


  reply	other threads:[~2011-09-04 17:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-04 15:22 John Carr
2011-09-04 17:28 ` Hezekiah M. Carty [this message]
2011-09-04 20:58 ` Richard W.M. Jones
2011-09-05  7:25 ` rixed
2011-09-05 15:16   ` John Carr
2011-09-05 22:11     ` John Carr
2011-09-06  7:50       ` Fabrice Le Fessant
2011-09-05  9:50 ` Gerd Stolpmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAMfPyLBmrQe47j1VPpTkq4n2zJ2ughC1zYyNaPH-nXxWGfUTSg@mail.gmail.com \
    --to=hcarty@atmos.umd.edu \
    --cc=caml-list@inria.fr \
    --cc=jfc@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).