@@ -149,14 +149,35 @@ pub extern "wasm" fn ptr2int_array(ptr : Int) -> FixedArray[Int] =
149
149
pub extern "wasm" fn ptr2float_array(ptr : Int) -> FixedArray[Float] =
150
150
#|(func (param i32) (result i32) local.get 0 i32.const 4 i32.sub i32.const 241 i32.store8 local.get 0 i32.const 8 i32.sub)
151
151
152
- pub extern "wasm" fn ptr2uint64_array(ptr : Int) -> FixedArray[UInt64] =
153
- #|(func (param i32) (result i32) local.get 0 i32.const 4 i32.sub i32.load i32.const 1 i32.shr_u i32.const 241 i32.or local.get 0 i32.const 4 i32.sub i32.store local.get 0 i32.const 8 i32.sub)
152
+ extern "wasm" fn ptr2uint64_array_ffi(ptr : Int) -> FixedArray[UInt64] =
153
+ #|(func (param i32) (result i32) local.get 0 i32.const 8 i32.sub)
154
+
155
+ pub fn ptr2uint64_array(ptr : Int) -> FixedArray[UInt64] {
156
+ set_64_header_ffi(ptr - 4)
157
+ ptr2uint64_array_ffi(ptr)
158
+ }
154
159
155
- pub extern "wasm" fn ptr2int64_array(ptr : Int) -> FixedArray[Int64] =
156
- #|(func (param i32) (result i32) local.get 0 i32.const 4 i32.sub i32.load i32.const 1 i32.shr_u i32.const 241 i32.or local.get 0 i32.const 4 i32.sub i32.store local.get 0 i32.const 8 i32.sub)
160
+ extern "wasm" fn ptr2int64_array_ffi(ptr : Int) -> FixedArray[Int64] =
161
+ #|(func (param i32) (result i32) local.get 0 i32.const 8 i32.sub)
162
+
163
+ pub fn ptr2int64_array(ptr : Int) -> FixedArray[Int64] {
164
+ set_64_header_ffi(ptr - 4)
165
+ ptr2int64_array_ffi(ptr)
166
+ }
157
167
158
- pub extern "wasm" fn ptr2double_array(ptr : Int) -> FixedArray[Double] =
159
- #|(func (param i32) (result i32) local.get 0 i32.const 4 i32.sub i32.load i32.const 1 i32.shr_u i32.const 241 i32.or local.get 0 i32.const 4 i32.sub i32.store local.get 0 i32.const 8 i32.sub)
168
+ extern "wasm" fn ptr2double_array_ffi(ptr : Int) -> FixedArray[Double] =
169
+ #|(func (param i32) (result i32) local.get 0 i32.const 8 i32.sub)
170
+
171
+ pub fn ptr2double_array(ptr : Int) -> FixedArray[Double] {
172
+ set_64_header_ffi(ptr - 4)
173
+ ptr2double_array_ffi(ptr)
174
+ }
175
+
176
+ fn set_64_header_ffi(offset : Int) -> Unit {
177
+ let len = load32(offset)
178
+ store32(offset, len.lsr(1))
179
+ store8(offset, 241)
180
+ }
160
181
161
182
pub trait Any {}
162
183
pub struct Cleanup {
0 commit comments