Skip to content

Commit b5a5003

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 b5a5003

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

src/lib.rs

Lines changed: 1 addition & 0 deletions
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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,8 @@ macro_rules! no_mangle {
1515
}
1616

1717
#[cfg(any(
18-
all(
19-
target_family = "wasm",
20-
target_os = "unknown",
21-
not(target_env = "wasi")
22-
),
18+
all(target_family = "wasm", target_os = "unknown", not(target_env = "wasi")),
19+
target_os = "xous",
2320
all(target_arch = "x86_64", target_os = "uefi"),
2421
all(target_arch = "xtensa", target_os = "none"),
2522
all(target_vendor = "fortanix", target_env = "sgx")
@@ -65,11 +62,8 @@ no_mangle! {
6562
}
6663

6764
#[cfg(any(
68-
all(
69-
target_family = "wasm",
70-
target_os = "unknown",
71-
not(target_env = "wasi")
72-
),
65+
all(target_family = "wasm", target_os = "unknown", not(target_env = "wasi")),
66+
target_os = "xous",
7367
all(target_arch = "xtensa", target_os = "none"),
7468
all(target_vendor = "fortanix", target_env = "sgx")
7569
))]
@@ -93,7 +87,13 @@ no_mangle! {
9387
fn tanf(n: f32) -> f32;
9488
}
9589

96-
#[cfg(all(target_vendor = "fortanix", target_env = "sgx"))]
90+
#[cfg(target_os = "xous")]
91+
no_mangle! {
92+
fn sqrtf(x: f32) -> f32;
93+
fn sqrt(x: f64) -> f64;
94+
}
95+
96+
#[cfg(any(all(target_vendor = "fortanix", target_env = "sgx"), target_os = "xous"))]
9797
no_mangle! {
9898
fn ceil(x: f64) -> f64;
9999
fn ceilf(x: f32) -> f32;

0 commit comments

Comments
 (0)