caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Dmitry Bely <dmitry.bely@gmail.com>
To: Caml List <caml-list@inria.fr>
Subject: [Caml-list] Int32 vs float unboxing
Date: Mon, 22 Aug 2011 11:19:27 +0400	[thread overview]
Message-ID: <CAMT7qiSc+KHupf2RzwmWV_WRwNt91wTsyJ0gtYE00krqBA8WZQ@mail.gmail.com> (raw)

In the code below "s" reference is unboxed in sum_float loop, but not
in sum_in32. Why?

let sum_int32 v =
  let s = ref 0l in
  for i=0 to (Array.length v)-1 do
    s := Int32.add !s (Array.unsafe_get v i)
  done;
  Int32.add !s Int32.zero

let sum_float v =
  let s = ref 0. in
  for i=0 to (Array.length v)-1 do
    s := !s +. (Array.unsafe_get v i)
  done;
  !s +. 0.

- Dmitry Bely

             reply	other threads:[~2011-08-22  7:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-22  7:19 Dmitry Bely [this message]
2011-08-22  7:58 ` Alain Frisch
2011-08-22  8:33   ` Dmitry Bely
2011-08-24  8:10 ` [Caml-list] " Dmitry Bely

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=CAMT7qiSc+KHupf2RzwmWV_WRwNt91wTsyJ0gtYE00krqBA8WZQ@mail.gmail.com \
    --to=dmitry.bely@gmail.com \
    --cc=caml-list@inria.fr \
    /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).