diff options
| author | Alasdair Armstrong | 2018-05-31 18:42:27 +0100 |
|---|---|---|
| committer | Alasdair Armstrong | 2018-05-31 18:42:27 +0100 |
| commit | 8745f6b56fe3c523a8730baed1fc1f7cc54b377b (patch) | |
| tree | 22db6ce8f634e5fec8635a7139286b0df096862c /src | |
| parent | 6a360137340c86006b4f3a7c6564717299cb1761 (diff) | |
Fix for Jenkins build
Looks like Jenkins is still on OCaml 4.02.3. We should probably upgrade to 4.05 at some point.
Diffstat (limited to 'src')
| -rw-r--r-- | src/sail_lib.ml | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/sail_lib.ml b/src/sail_lib.ml index 082df4c1..8a3072c2 100644 --- a/src/sail_lib.ml +++ b/src/sail_lib.ml @@ -540,8 +540,16 @@ 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 String.split_on_char '.' str with + match 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 |
