fix Array.sort (PR#33)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@2965 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02master
parent
078a40e1d6
commit
d512c37344
|
@ -63,6 +63,9 @@ let array cmp arr =
|
|||
end;
|
||||
let pivot = unsafe_get arr mid in
|
||||
let i = ref (lo + 1) and j = ref (hi - 1) in
|
||||
if not (cmp pivot (unsafe_get arr hi))
|
||||
|| not (cmp (unsafe_get arr lo) pivot)
|
||||
then raise (Invalid_argument "Sort.array");
|
||||
while !i < !j do
|
||||
while not (cmp pivot (unsafe_get arr !i)) do incr i done;
|
||||
while not (cmp (unsafe_get arr !j) pivot) do decr j done;
|
||||
|
|
Loading…
Reference in New Issue