1 /* *********************************************************************/
3 /* The Compcert verified compiler */
5 /* Xavier Leroy, INRIA Paris-Rocquencourt */
7 /* Copyright Institut National de Recherche en Informatique et en */
8 /* Automatique. All rights reserved. This file is distributed */
9 /* under the terms of the GNU General Public License as published by */
10 /* the Free Software Foundation, either version 2 of the License, or */
11 /* (at your option) any later version. This file is also distributed */
12 /* under the terms of the INRIA Non-Commercial License Agreement. */
14 /* *********************************************************************/
16 #include <caml/mlvalues.h>
17 #include <caml/alloc.h>
19 value cparser_int64_unsigned_to_float(value v)
21 return caml_copy_double((double)((uint64) Int64_val(v)));
24 value cparser_int64_unsigned_div(value v1, value v2)
26 return caml_copy_int64((uint64) Int64_val(v1) / (uint64) Int64_val(v2));
29 value cparser_int64_unsigned_mod(value v1, value v2)
31 return caml_copy_int64((uint64) Int64_val(v1) % (uint64) Int64_val(v2));
34 value cparser_int64_unsigned_compare(value v1, value v2)
36 uint64 n1 = (uint64) Int64_val(v1);
37 uint64 n2 = (uint64) Int64_val(v2);
38 if (n1 < n2) return Val_int(-1);
39 if (n1 > n2) return Val_int(1);