Skip to content

Commit

Permalink
refactor(pkg): apply @talex5 optimization (#11294)
Browse files Browse the repository at this point in the history
  • Loading branch information
rgrinberg authored Jan 14, 2025
1 parent 3e0def1 commit 6509b67
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions vendor/opam/src/core/opamVersionCompare.ml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,9 @@ let is_digit = function
(* [skip_while_from i f w m] yields the index of the leftmost character
* in the string [s], starting from [i], and ending at [m], that does
* not satisfy the predicate [f], or [length w] if no such index exists. *)
let skip_while_from i f w m =
let rec loop i =
if i = m then i
else if f w.[i] then loop (i + 1) else i
in loop i
;;
let rec skip_while_from i f w m =
if i = m then i
else if f w.[i] then skip_while_from (i + 1) f w m else i

(* splits a version into (epoch,rest), without the separating ':'. The
* epoch is delimited by the leftmost occurrence of ':' in x, and is ""
Expand Down

0 comments on commit 6509b67

Please sign in to comment.