Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
汇编脚本中是否有任何方法可以获取 f64 类型的指针?
有用:
let c: ClassA; changetype<usize>(c)
它不起作用
let f:f64 changetype<usize>(f)
原始数字类型不是堆分配的。都作为局部变量在当前函数的堆栈上。如果你想分配它,你可以使用__alloc,例如
__alloc
let f_ptr = __alloc(sizeof<f64>()); store<f64>(f_ptr, f);
如果您尝试将 传递f64给 javascript,则不必使用间接,因为它是导入/导出中可能的类型之一,以及整数。
f64