Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Xavier Leroy <Xavier.Leroy@inria.fr>
To: Christopher Oliver <oliver@fritz.traverse.com>, caml-list@inria.fr
Subject: Re: Marshalling of floats
Date: Wed, 5 Aug 1998 10:00:18 +0200	[thread overview]
Message-ID: <19980805100018.38349@pauillac.inria.fr> (raw)
In-Reply-To: <E0z3lz5-00008u-00@fritz.traverse.net>; from Christopher Oliver on Tue, Aug 04, 1998 at 02:38:55PM -0400

> First, floats are simply written in increasing byte order OCAML
> makes no attempt to rearrange based on endianness.

Floats are written in "native" endianness (the natural endianness of
the machine writing the file), but along with a flag telling which
endianness is used.  input_value, then, swaps bytes if it runs on a
processor whose endianness does not match that used to create the
file.  This is more efficient than converting to and from a fixed
endianness in the frequent case where the data is read back on the
same machine that wrote it.

> Should OCAML swap byte orders on some hardware to try to compen-
> sate, or should we make no attempt to record floating point
> portably between the major architectures?  The change in byterun/
> intern.c and byterun/extern.c to handle byte swapping is fairly
> trivial provided we include the config.h

input_value/output_value is already portable across all platforms that
use IEEE floats.  The byte-swapping code is already in byterun/intern.c.

> Harder, does anyone have any good ideas besides conversion to
> and from lists for marshalling floating arrays between bytecode
> and native OCAML programs?  Without this sort of thing, one must
> walk structures by hand if there are variant types with floating
> arrays.

The next release of OCaml will use the same format for float arrays in
native-code and in bytecode, thus solving this problem.

Regards,

- Xavier Leroy





  reply	other threads:[~1998-08-12 20:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-08-04 18:38 Christopher Oliver
1998-08-05  8:00 ` Xavier Leroy [this message]
1998-08-05  8:13   ` Christopher Oliver

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=19980805100018.38349@pauillac.inria.fr \
    --to=xavier.leroy@inria.fr \
    --cc=caml-list@inria.fr \
    --cc=oliver@fritz.traverse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox