[Libguestfs] [nbdkit PATCH 2/2] ocaml: Implement .list_exports and friends

Richard W.M. Jones rjones at redhat.com
Tue Sep 1 14:38:06 UTC 2020


On Tue, Sep 01, 2020 at 03:13:28PM +0100, Richard W.M. Jones wrote:
> Val_int(0) turns C int 0 into an OCaml int.  Which is done by shifting
> it left one place and setting the bottom bit.  IOW it returns C 1.

That was confusing.

I mean Val_int(0) returns the C representation of the OCaml integer 0
(or integer-like thing: None is also represented as the OCaml integer 0).

This is also the reason why OCaml ints are 63 bits, and you must use
the OCaml int64 type (which is boxed) to store a true 64 bit int.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://libguestfs.org




More information about the Libguestfs mailing list