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
Unsigned int ?!
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2000-06-21 (13:18)
From: Xavier Leroy <Xavier.Leroy@i...>
Subject: Re: Unsigned int ?!
> I would like to get the "caml unsigned int value" of an "unsigned int C
> value". Is there a way to do this ??
> I do the following, and it fails ...

I tried to reproduce the problem from your (incomplete) code snippet,
and everything worked fine.  If you have a complete (self-contained)
program that reproduces the problem, please send it to

As for the unsigned vs. signed issue, it's just two ways to view the
same bit patterns: the most significant bit of the unsigned int becomes
the sign bit of the signed int.  So, for "small enough" unsigned ints,
you will see them as the corresponding Caml int; large unsigned ints
wrap around.

- Xavier Leroy