diff options
| author | Robert Norton | 2017-04-21 17:04:52 +0100 |
|---|---|---|
| committer | Robert Norton | 2017-04-21 17:05:28 +0100 |
| commit | 70e9a92183b38c7b79c0ee66f0cae72c8578bd00 (patch) | |
| tree | 345748ec165e2f1251da8f77edd4f9f591815904 /mips/run_embed.ml | |
| parent | a5d8b2dc56594c1c4d1f88b1017638b5eef69086 (diff) | |
it turns out zarith has a function for printing big_ints in hex. Remove the dependency on ocaml uint library by using it.
Diffstat (limited to 'mips/run_embed.ml')
| -rw-r--r-- | mips/run_embed.ml | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/mips/run_embed.ml b/mips/run_embed.ml index 183e2ff1..e28b9310 100644 --- a/mips/run_embed.ml +++ b/mips/run_embed.ml @@ -59,23 +59,8 @@ let rec foldli f acc ?(i=0) = function | [] -> acc | x::xs -> foldli f (f i acc x) ~i:(i+1) xs;; -let hex_to_big_int s = big_int_of_int64 (Int64.of_string s) ;; -let big_int_to_hex i = - (* annoyingly Uint64.to_string_hex prefixes the string with 0x UNLESS it is zero... *) - if i = zero_big_int then - "0" - else - let s = Uint64.to_string_hex (Uint64.of_string (string_of_big_int i)) in - let len = String.length s in - String.sub s 2 (len - 2) - -let big_int_to_hex64 i = - let hex = big_int_to_hex i in - let len = String.length hex in - if (len < 16) then - (String.make (16-len) '0') ^ hex - else - hex +let big_int_to_hex i = Z.format "%x" i +let big_int_to_hex64 i = Z.format "%016x" i let input_buf = (ref [] : int list ref);; |
