From c671a5cb30db29feda56f008d45789c2fd4928e9 Mon Sep 17 00:00:00 2001 From: Guillaume Melquiond Date: Fri, 1 Jan 2016 23:33:40 +0100 Subject: Do not make it harder on the compiler optimizer by packing arguments. --- lib/cList.ml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/cList.ml b/lib/cList.ml index 72f892a09d..bd3e09b5b2 100644 --- a/lib/cList.ml +++ b/lib/cList.ml @@ -645,12 +645,13 @@ let rec split3 = function let (rx, ry, rz) = split3 l in (x::rx, y::ry, z::rz) let firstn n l = - let rec aux acc = function - | (0, l) -> List.rev acc - | (n, (h::t)) -> aux (h::acc) (pred n, t) + let rec aux acc n l = + match n, l with + | 0, _ -> List.rev acc + | n, h::t -> aux (h::acc) (pred n) t | _ -> failwith "firstn" in - aux [] (n,l) + aux [] n l let rec last = function | [] -> failwith "List.last" -- cgit v1.2.3