caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Jérémie Dimino" <jeremie@dimino.org>
To: Jon Harrop <jon@ffconsultancy.com>
Cc: O'Caml Mailing List <caml-list@yquem.inria.fr>
Subject: Re: [Caml-list] Parsing 64-bit ints in 32-bit OCaml
Date: Sat, 07 Mar 2009 19:12:10 +0100	[thread overview]
Message-ID: <1236449530.4154.13.camel@localhost.localdomain> (raw)
In-Reply-To: <200903071728.56418.jon@ffconsultancy.com>

Jon Harrop wrote:
> Is there a better workaround?

A (maybe overkill) solution is to use optcomp [1]. What you have to do
is to add word_size variable:

  Pa_optcomp.define "word_size" (Int Sys.word_size)

Then you can write:

  let gcd3 = 
  #if word_size = 32
     715827883
  #elif word_size = 64
     3074457345618258603
  #else
  #  error "unknown word size"
  #endif

Jérémie
     
 [1] http://forge.ocamlcore.org/projects/optcomp/


  reply	other threads:[~2009-03-07 18:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-07 17:28 Jon Harrop
2009-03-07 18:12 ` Jérémie Dimino [this message]
2009-03-16 21:58 ` [Caml-list] " Jean-Christophe Filliâtre

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=1236449530.4154.13.camel@localhost.localdomain \
    --to=jeremie@dimino.org \
    --cc=caml-list@yquem.inria.fr \
    --cc=jon@ffconsultancy.com \
    /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).