Skip to content

Commit 2180b00

Browse files
committed
WIP
1 parent 4219be9 commit 2180b00

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

runtime/wasm/array.wat

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,22 @@
5151
(array.set $block (local.get $b) (i32.const 0) (ref.i31 (i32.const 0)))
5252
(local.get $b))
5353

54+
;; ZZZ Unboxed version
55+
(func (export "caml_floatarray_make")
56+
(param $n (ref eq)) (param $v (ref eq)) (result (ref eq))
57+
(local $sz i32) (local $f f64)
58+
(local.set $sz (i31.get_s (ref.cast (ref i31) (local.get $n))))
59+
(if (i32.lt_s (local.get $sz) (i32.const 0))
60+
(then
61+
(call $caml_invalid_argument
62+
(array.new_data $string $Array_make
63+
(i32.const 0) (i32.const 10)))))
64+
(if (i32.eqz (local.get $sz)) (then (return (global.get $empty_array))))
65+
(local.set $f
66+
(struct.get $float 0
67+
(ref.cast (ref $float) (local.get $v))))
68+
(array.new $float_array (local.get $f) (local.get $sz)))
69+
5470
(export "caml_make_float_vect" (func $caml_floatarray_create))
5571
(func $caml_floatarray_create (export "caml_floatarray_create")
5672
(param $n (ref eq)) (result (ref eq))

runtime/wasm/md5.wat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
(field (ref $int_array)) ;; buffer
3333
(field (ref $string)))) ;; intermediate buffer
3434

35-
(func (export "caml_md5_string")
35+
(func (export "caml_md5_string") (export "caml_md5_bytes")
3636
(param (ref eq)) (param (ref eq)) (param (ref eq)) (result (ref eq))
3737
(local $ctx (ref $context))
3838
(local.set $ctx (call $MD5Init))

0 commit comments

Comments
 (0)