English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] hash_variant anomalies
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2001-07-03 (02:16)
From: Chris Quinn <cq@h...>
Subject: Re: [Caml-list] hash_variant anomalies
The Caml runtime makes a basic distinction between memory pointers and everything else - pointers are mod 2 while everything else is shifted along 1 bit and has the lsb set to 1. This allows for operation of the garbage collector. Integers are in the 'everything else' camp so 0 maps to 1, 1 to 3 ...etc.
The macros Val_int(x) and Int_val(v) allow for conversion to and from caml integer values and appropriate use of these will correct the apparent anomaly.
Chris Quinn
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr