We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 13dcd7f commit af4f85fCopy full SHA for af4f85f
src/lib.rs
@@ -1,5 +1,5 @@
1
#![cfg_attr(feature = "allocator-api", feature(allocator_api))]
2
-#![cfg_attr(target_arch = "wasm32", feature(stdsimd))]
+#![cfg_attr(target_arch = "wasm32", feature(link_llvm_intrinsics))]
3
#![cfg_attr(not(feature = "allocator-api"), allow(dead_code))]
4
#![no_std]
5
src/wasm.rs
@@ -1,9 +1,13 @@
use core::ptr;
-use core::arch::wasm32;
+
+extern {
+ #[link_name = "llvm.wasm.grow.memory.i32"]
+ fn grow_memory(pages: u32) -> i32;
6
+}
7
8
pub unsafe fn alloc(size: usize) -> (*mut u8, usize, u32) {
9
let pages = size / page_size();
- let prev = wasm32::grow_memory(pages as i32);
10
+ let prev = grow_memory(pages as u32);
11
if prev == -1 {
12
return (ptr::null_mut(), 0, 0);
13
}
0 commit comments