Skip to content

Commit b22eef9

Browse files
committed
math: compile math functions for Xous
This adds support for Xous, enabling users to call math functions on primitives such as `cos()`. Signed-off-by: Sean Cross <[email protected]>
1 parent 4fa69f1 commit b22eef9

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ pub mod int;
4646
all(target_family = "wasm", target_os = "unknown"),
4747
all(target_arch = "x86_64", target_os = "uefi"),
4848
all(target_arch = "arm", target_os = "none"),
49+
target_os = "xous",
4950
all(target_vendor = "fortanix", target_env = "sgx")
5051
))]
5152
pub mod math;

src/math.rs

+12-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ macro_rules! no_mangle {
2020
target_os = "unknown",
2121
not(target_env = "wasi")
2222
),
23+
target_os = "xous",
2324
all(target_arch = "x86_64", target_os = "uefi"),
2425
all(target_arch = "xtensa", target_os = "none"),
2526
all(target_vendor = "fortanix", target_env = "sgx")
@@ -70,6 +71,7 @@ no_mangle! {
7071
target_os = "unknown",
7172
not(target_env = "wasi")
7273
),
74+
target_os = "xous",
7375
all(target_arch = "xtensa", target_os = "none"),
7476
all(target_vendor = "fortanix", target_env = "sgx")
7577
))]
@@ -93,7 +95,16 @@ no_mangle! {
9395
fn tanf(n: f32) -> f32;
9496
}
9597

96-
#[cfg(all(target_vendor = "fortanix", target_env = "sgx"))]
98+
#[cfg(target_os = "xous")]
99+
no_mangle! {
100+
fn sqrtf(x: f32) -> f32;
101+
fn sqrt(x: f64) -> f64;
102+
}
103+
104+
#[cfg(any(
105+
all(target_vendor = "fortanix", target_env = "sgx"),
106+
target_os = "xous"
107+
))]
97108
no_mangle! {
98109
fn ceil(x: f64) -> f64;
99110
fn ceilf(x: f32) -> f32;

0 commit comments

Comments
 (0)