Skip to content

Commit fb912c7

Browse files
committed
Switch to using wasm intrinsics
1 parent da895ba commit fb912c7

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
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, alloc))]
2-
#![cfg_attr(target_arch = "wasm32", feature(link_llvm_intrinsics))]
2+
#![cfg_attr(target_arch = "wasm32", feature(stdsimd))]
33
#![cfg_attr(not(feature = "allocator-api"), allow(dead_code))]
44
#![no_std]
55

src/wasm.rs

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

84
pub unsafe fn alloc(size: usize) -> (*mut u8, usize, u32) {
95
let pages = size / page_size();
10-
let prev = grow_memory(pages as u32);
6+
let prev = wasm32::grow_memory(pages as i32);
117
if prev == -1 {
128
return (ptr::null_mut(), 0, 0);
139
}

0 commit comments

Comments
 (0)