Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
* unsigned word type in OCaml?
@ 1999-01-29 22:23 Sussillo, David
  1999-01-31 12:20 ` Jean-Christophe Filliatre
  1999-02-01 14:10 ` Xavier Leroy
  0 siblings, 2 replies; 3+ messages in thread
From: Sussillo, David @ 1999-01-29 22:23 UTC (permalink / raw)
  To: 'caml-list@inria.fr'


Hello,

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)

Have I missed something either in the mailing list or the documentation?   
 What about (yuk) storing my OCaml words as strings and then  passing   
these strings to C and operating on them there? Wouldn't be great, but   
maybe a it's a temporary solution.

Thanks,
dave   




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: unsigned word type in OCaml?
  1999-01-29 22:23 unsigned word type in OCaml? Sussillo, David
@ 1999-01-31 12:20 ` Jean-Christophe Filliatre
  1999-02-01 14:10 ` Xavier Leroy
  1 sibling, 0 replies; 3+ messages in thread
From: Jean-Christophe Filliatre @ 1999-01-31 12:20 UTC (permalink / raw)
  To: Sussillo, David; +Cc: 'caml-list@inria.fr'


> 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)

One year ago, I wrote a small (boxed) 32-bit integers library for
ocaml, which is freely available here :

       http://www.lri.fr/~filliatr/ftp/ocaml/int32/

It provides the standard operations, including bitwise boolean operations.
It is easy to adapt it to unsigned 32-bit integers.

-- 
Jean-Christophe FILLIATRE
  mailto:Jean-Christophe.Filliatre@lri.fr
  http://www.lri.fr/~filliatr




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: unsigned word type in OCaml?
  1999-01-29 22:23 unsigned word type in OCaml? Sussillo, David
  1999-01-31 12:20 ` Jean-Christophe Filliatre
@ 1999-02-01 14:10 ` Xavier Leroy
  1 sibling, 0 replies; 3+ messages in thread
From: Xavier Leroy @ 1999-02-01 14:10 UTC (permalink / raw)
  To: Sussillo, David, 'caml-list@inria.fr'

> 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




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1999-02-03 12:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-01-29 22:23 unsigned word type in OCaml? Sussillo, David
1999-01-31 12:20 ` Jean-Christophe Filliatre
1999-02-01 14:10 ` Xavier Leroy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox