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

-- 
Caml-list mailing list.  Subscription management and archives:
https://sympa-roc.inria.fr/wws/info/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Reply via email to