diff options
| author | Alasdair Armstrong | 2018-06-04 14:55:55 +0100 |
|---|---|---|
| committer | Alasdair Armstrong | 2018-06-04 14:56:24 +0100 |
| commit | 5bc1cedf8dba96936755af30ca6e82fe052137c3 (patch) | |
| tree | 0cbdb4c150f96ebc89d1bf1b1d6bb7fbca238af2 | |
| parent | b98a28ab824a56a9d3f0f07cb69f3b1c5ecf3cdd (diff) | |
Use Util.split_on_char in sail_lib.ml
| -rw-r--r-- | src/sail_lib.ml | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/src/sail_lib.ml b/src/sail_lib.ml index 8a3072c2..e4b5619c 100644 --- a/src/sail_lib.ml +++ b/src/sail_lib.ml @@ -540,16 +540,8 @@ let rec pow x = function | 0 -> 1 | n -> x * pow x (n - 1) -(* FIXME: Copy split_on_char from util.ml until we upgrade Jenkins to OCaml 4.05 *) -let rec split_on_char sep str = - try - let sep_pos = String.index str sep in - String.sub str 0 sep_pos :: split_on_char sep (String.sub str (sep_pos + 1) (String.length str - (sep_pos + 1))) - with - | Not_found -> [str] - let real_of_string str = - match split_on_char '.' str with + match Util.split_on_char '.' str with | [whole; frac] -> let whole = Rational.of_int (int_of_string whole) in let frac = Rational.div (Rational.of_int (int_of_string frac)) (Rational.of_int (pow 10 (String.length frac))) in |
