#6180: efficient creation of uninitialized float arrays.

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14156 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
master
Alain Frisch 2013-09-17 11:54:31 +00:00
parent 9a4a944363
commit 2373f76c36
7 changed files with 15 additions and 0 deletions

View File

@ -27,6 +27,7 @@ Standard library:
- PR#4986: add List.sort_uniq and Set.of_list
- PR#6148: speed improvement for Buffer (patch by John Whitington)
- PR#6146: support "Unix.kill pid Sys.sigkill" under Windows
- PR#6180: efficient creation of uninitialized float arrays
Features wishes:
- PR#4243: make the Makefiles parallelizable

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -135,6 +135,16 @@ CAMLprim value caml_array_unsafe_set(value array, value index, value newval)
return caml_array_unsafe_set_addr(array, index, newval);
}
CAMLprim value caml_make_float_vect(value len)
{
mlsize_t wsize = Long_val(len) * Double_wosize;
if (wsize == 0)
return Atom(0);
if (wsize > Max_wosize)
caml_invalid_argument("Array.make");
return caml_alloc(wsize, Double_array_tag);
}
CAMLprim value caml_make_vect(value len, value init)
{
CAMLparam2 (len, init);

View File

@ -25,6 +25,7 @@ external append_prim : 'a array -> 'a array -> 'a array = "caml_array_append"
external concat : 'a array list -> 'a array = "caml_array_concat"
external unsafe_blit :
'a array -> int -> 'a array -> int -> int -> unit = "caml_array_blit"
external make_float: int -> float array = "caml_make_float_vect"
let init l f =
if l = 0 then [||] else

View File

@ -150,6 +150,9 @@ val fold_right : ('b -> 'a -> 'a) -> 'b array -> 'a -> 'a
[f a.(0) (f a.(1) ( ... (f a.(n-1) x) ...))],
where [n] is the length of the array [a]. *)
external make_float: int -> float array = "caml_make_float_vect"
(** [Array.make_float n] returns a fresh float array of length [n],
with uninitialized data. *)
(** {6 Sorting} *)