Re: unsigned word type in OCaml?

From: Xavier Leroy (Xavier.Leroy@inria.fr)
Date: Mon Feb 01 1999 - 15:10:47 MET


Date: Mon, 1 Feb 1999 15:10:47 +0100
From: Xavier Leroy <Xavier.Leroy@inria.fr>
To: "Sussillo, David" <sussillo@ftintl.com>,
Subject: Re: unsigned word type in OCaml?
In-Reply-To: <36B23B0D@smtp.ftintl.com>; from Sussillo, David on Fri, Jan 29, 1999 at 02:23:00PM -0800

> I'm working on a low level systems project, and I'm thinking about using
> OCaml as the langauge. However, try as I might, I simply cannot find a
> reference to a machine word type.
>
> More specially, I need:
> a. byte access to machine words
> b. unsigned 32 bit quantities (e.g. physical address)
> c. bitwise boolean operations (shifts, not, and & or)

None of this is supported natively in the language (OCaml's "int" type
and its associated operations is 31 or 63 bits, signed).

However, it's easy to define your "machine word" type as an abstract
type and implement it via small C functions.

Jean-Christophe Filliatre's "int32" library is a good starting point:

        http://pauillac.inria.fr/caml/caml-list/0200.html
        http://www.ens-lyon.fr/~jcfillia/ftp/ocaml/int32

Regards,

- Xavier Leroy



This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:19 MET