Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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: -- (:)
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:  FAQ:
To unsubscribe, mail  Archives: