Skip to content

Commit af4f85f

Browse files
committed
Revert "Switch to using wasm intrinsics"
This reverts commit fb912c7.
1 parent 13dcd7f commit af4f85f

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#![cfg_attr(feature = "allocator-api", feature(allocator_api))]
2-
#![cfg_attr(target_arch = "wasm32", feature(stdsimd))]
2+
#![cfg_attr(target_arch = "wasm32", feature(link_llvm_intrinsics))]
33
#![cfg_attr(not(feature = "allocator-api"), allow(dead_code))]
44
#![no_std]
55

src/wasm.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
use core::ptr;
2-
use core::arch::wasm32;
2+
3+
extern {
4+
#[link_name = "llvm.wasm.grow.memory.i32"]
5+
fn grow_memory(pages: u32) -> i32;
6+
}
37

48
pub unsafe fn alloc(size: usize) -> (*mut u8, usize, u32) {
59
let pages = size / page_size();
6-
let prev = wasm32::grow_memory(pages as i32);
10+
let prev = grow_memory(pages as u32);
711
if prev == -1 {
812
return (ptr::null_mut(), 0, 0);
913
}

0 commit comments

Comments
 (0)