caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jacques Garrigue <garrigue@math.nagoya-u.ac.jp>
To: tom.primozic@gmail.com
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Re: Reading 16 bit floats from stream?
Date: Tue, 17 Oct 2006 08:25:28 +0900 (JST)	[thread overview]
Message-ID: <20061017.082528.59485463.garrigue@math.nagoya-u.ac.jp> (raw)
In-Reply-To: <c1490a380610161335w2f8fe472ree7bbe4e6269ef2f@mail.gmail.com>

From: Tom <tom.primozic@gmail.com>

> val Pervasives.input_binary_int : in_channel -> int

This will indeed read a 32-bit integer, but on a 32-bit architecture
ocaml int's are 31-bit, so you loose the highest bit.
Note that on a 64-bit architecture this is sufficient for 32-bit
integers!

> val Pervasives.read_int : unit -> int

This one reads a string...

> val Marshal.from_channel : in_channel -> 'a

And this one reads a marshalled value, which must include a special
header indicating its ocaml representation.

So if you really need to read a full 32-bit integer, none of these
will work, and you must do the job by hand.

Jacques Garrigue


  reply	other threads:[~2006-10-16 23:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <e919163f0610160833t6b04489ev46a2c4dd28860729@mail.gmail.com>
2006-10-16 15:44 ` Maurizio Colucci
2006-10-16 16:03   ` Maurizio Colucci
2006-10-16 16:27     ` [Caml-list] " Gerd Stolpmann
2006-10-16 17:06       ` Maurizio Colucci
2006-10-16 17:23         ` Tom
2006-10-16 20:19         ` Martin Jambon
2006-10-16 20:35           ` Tom
2006-10-16 23:25             ` Jacques Garrigue [this message]
2006-10-17 14:02               ` Maurizio Colucci
2006-10-17 14:32                 ` Gerd Stolpmann

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=20061017.082528.59485463.garrigue@math.nagoya-u.ac.jp \
    --to=garrigue@math.nagoya-u.ac.jp \
    --cc=caml-list@yquem.inria.fr \
    --cc=tom.primozic@gmail.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;
as well as URLs for NNTP newsgroup(s).