Browse thread
Parsing 64-bit ints in 32-bit OCaml
-
Jon Harrop
- Jérémie Dimino
- Jean-Christophe_Filliâtre
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Jérémie Dimino <jeremie@d...> |
| Subject: | Re: [Caml-list] Parsing 64-bit ints in 32-bit OCaml |
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/