[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 2/3] libxl: ocaml: use int64 for timeval fields in the timeout_register callback



Ian Jackson wrote:
> Sent: 12 December 2013 5:14 PM
> To: Rob Hoes
> Cc: xen-devel@xxxxxxxxxxxxx; Ian Campbell; Dave Scott
> Subject: RE: [PATCH 2/3] libxl: ocaml: use int64 for timeval fields in the
> timeout_register callback
> 
> Rob Hoes writes ("RE: [PATCH 2/3] libxl: ocaml: use int64 for timeval
> fields in the timeout_register callback"):
> > Ian Jackson wrote:
> > > (The tv_nsec field is guaranteed to be < 1E9 so fits in 30 bits...)
> >
> > The OCaml Unix.gettimeofday function returns a number of type "float",
> which in OCaml is a 64-bit number. This may be an alternative.
> 
> You mean it has a 64-bit mantissa, or it's 64 bits big (an IEEE
> double) ?

64 bits big, according to the IEEE 754 standard 
(http://caml.inria.fr/pub/docs/manual-ocaml/libref/Pervasives.html),

> Also that's a very strange way of representing a timeval (which is mixed
> radix, since the two halves have relative weight 10^9 rather than 2^n).
> 
> > I just thought it would be best to stay as close as possible to the C
> > implementation in the bindings, and return the two separate numbers
> > that we are given.
> 
> Right.  I think on the basis of what you've said, that makes sense,
> although I'm not sure whether nsec should be 32 (30+sign) or 64.

I guess we can probably get away with 32 bits for that one, based on what we 
know the of the range of possible values. I'd just like to avoid any possible 
trouble, and didn't think those extra bits would cause too much harm.

Rob

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.