diff --git a/lib-cudf/opam_0install_cudf.ml b/lib-cudf/opam_0install_cudf.ml index 4a7fff6..85adbd6 100644 --- a/lib-cudf/opam_0install_cudf.ml +++ b/lib-cudf/opam_0install_cudf.ml @@ -4,12 +4,20 @@ let tagged_with_avoid_version pkg = | _ -> false ) pkg.Cudf.pkg_extra -let version_rev_compare ~prefer_oldest pkg1 pkg2 = - let rev cmp = if prefer_oldest then cmp else -cmp in - match tagged_with_avoid_version pkg1, tagged_with_avoid_version pkg2 with - | true, true | false, false -> rev (Int.compare pkg1.Cudf.version pkg2.Cudf.version) - | true, false -> 1 - | false, true -> -1 +let version_rev_compare ~prefer_oldest = + (* Unrolled for performance purpose *) + if prefer_oldest then + fun pkg1 pkg2 -> + match tagged_with_avoid_version pkg1, tagged_with_avoid_version pkg2 with + | true, true | false, false -> Int.compare pkg1.Cudf.version pkg2.Cudf.version + | true, false -> 1 + | false, true -> -1 + else + fun pkg1 pkg2 -> + match tagged_with_avoid_version pkg1, tagged_with_avoid_version pkg2 with + | true, true | false, false -> Int.compare pkg2.Cudf.version pkg1.Cudf.version + | true, false -> 1 + | false, true -> -1 module Context = struct type rejection = UserConstraint of Cudf_types.vpkg