From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p84HSru2029307 for ; Sun, 4 Sep 2011 19:28:54 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AlgBAPW0Y07RVdQ2kGdsb2JhbABBDgiEN6QTCBQBAQEBCQkNBxQEIoFGAQEBAQMSAg9WEAEKCwMKAgImAgIiEgEFARwGEyKHVZsDCot9hzGIf4EshC2BEQSTLoxmPIMzVA X-IronPort-AV: E=Sophos;i="4.68,329,1312149600"; d="scan'208";a="107634212" Received: from mail-vw0-f54.google.com ([209.85.212.54]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 04 Sep 2011 19:28:48 +0200 Received: by vws18 with SMTP id 18so6130351vws.27 for ; Sun, 04 Sep 2011 10:28:47 -0700 (PDT) Received: by 10.52.34.73 with SMTP id x9mr1748405vdi.474.1315157327088; Sun, 04 Sep 2011 10:28:47 -0700 (PDT) MIME-Version: 1.0 Sender: hcarty@mulethief.com Received: by 10.52.188.162 with HTTP; Sun, 4 Sep 2011 10:28:27 -0700 (PDT) In-Reply-To: <201109041522.p84FM5DA001371@outgoing.mit.edu> References: <201109041522.p84FM5DA001371@outgoing.mit.edu> From: "Hezekiah M. Carty" Date: Sun, 4 Sep 2011 13:28:27 -0400 X-Google-Sender-Auth: 3yrKdYhRqRN6Y4bqHVnWs-VfuKQ Message-ID: To: John Carr Cc: caml-list@inria.fr Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by walapai.inria.fr id p84HSru2029307 Subject: Re: [Caml-list] Conditionally boxed 32 bit integers? On Sun, Sep 4, 2011 at 11:22 AM, John Carr 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