summaryrefslogtreecommitdiffstats
path: root/byterun/ints.c
diff options
context:
space:
mode:
Diffstat (limited to 'byterun/ints.c')
-rw-r--r--byterun/ints.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/byterun/ints.c b/byterun/ints.c
index 00d354e08..687662081 100644
--- a/byterun/ints.c
+++ b/byterun/ints.c
@@ -223,6 +223,12 @@ value int32_of_int(value v) /* ML */
value int32_to_int(value v) /* ML */
{ return Val_long(Int32_val(v)); }
+value int32_of_float(value v) /* ML */
+{ return copy_int32((int32)(Double_val(v))); }
+
+value int32_to_float(value v) /* ML */
+{ return copy_double((double)(Int32_val(v))); }
+
value int32_format(value fmt, value arg) /* ML */
{
char format_string[32], default_format_buffer[32];
@@ -355,6 +361,12 @@ value int64_of_int(value v) /* ML */
value int64_to_int(value v) /* ML */
{ return Val_long((long) Int64_val(v)); }
+value int64_of_float(value v) /* ML */
+{ return copy_int64((int64)(Double_val(v))); }
+
+value int64_to_float(value v) /* ML */
+{ return copy_double((double)(Int64_val(v))); }
+
value int64_of_int32(value v) /* ML */
{ return copy_int64(Int32_val(v)); }
@@ -451,6 +463,12 @@ value int64_of_int(value v)
value int64_to_int(value v)
{ invalid_argument(int64_error); }
+value int64_of_float(value v)
+{ invalid_argument(int64_error); }
+
+value int64_to_float(value v)
+{ invalid_argument(int64_error); }
+
value int64_of_int32(value v)
{ invalid_argument(int64_error); }
@@ -590,6 +608,12 @@ value nativeint_of_int(value v) /* ML */
value nativeint_to_int(value v) /* ML */
{ return Val_long(Nativeint_val(v)); }
+value nativeint_of_float(value v) /* ML */
+{ return copy_nativeint((long)(Double_val(v))); }
+
+value nativeint_to_float(value v) /* ML */
+{ return copy_double((double)(Nativeint_val(v))); }
+
value nativeint_of_int32(value v) /* ML */
{ return copy_nativeint(Int32_val(v)); }