Skip to content
This repository was archived by the owner on Apr 28, 2025. It is now read-only.

Commit 1ad29ac

Browse files
committed
Give the LLVM attribute to all public APIs
1 parent 3a59e93 commit 1ad29ac

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+112
-112
lines changed

src/math/acos.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ fn r(z: f64) -> f64 {
6262
/// Returns values in radians, in the range of 0 to pi.
6363
#[inline]
6464
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
65-
pub fn acos(x: f64) -> f64 {
65+
pub extern "C" fn acos(x: f64) -> f64 {
6666
let x1p_120f = f64::from_bits(0x3870000000000000); // 0x1p-120 === 2 ^ -120
6767
let z: f64;
6868
let w: f64;

src/math/acosf.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ fn r(z: f32) -> f32 {
3636
/// Returns values in radians, in the range of 0 to pi.
3737
#[inline]
3838
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
39-
pub fn acosf(x: f32) -> f32 {
39+
pub extern "C" fn acosf(x: f32) -> f32 {
4040
let x1p_120 = f32::from_bits(0x03800000); // 0x1p-120 === 2 ^ (-120)
4141

4242
let z: f32;

src/math/acosh.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const LN2: f64 = 0.693147180559945309417232121458176568; /* 0x3fe62e42, 0xfefa3
77
/// Calculates the inverse hyperbolic cosine of `x`.
88
/// Is defined as `log(x + sqrt(x*x-1))`.
99
/// `x` must be a number greater than or equal to 1.
10-
pub fn acosh(x: f64) -> f64 {
10+
pub extern "C" fn acosh(x: f64) -> f64 {
1111
let u = x.to_bits();
1212
let e = ((u >> 52) as usize) & 0x7ff;
1313

src/math/acoshf.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const LN2: f32 = 0.693147180559945309417232121458176568;
77
/// Calculates the inverse hyperbolic cosine of `x`.
88
/// Is defined as `log(x + sqrt(x*x-1))`.
99
/// `x` must be a number greater than or equal to 1.
10-
pub fn acoshf(x: f32) -> f32 {
10+
pub extern "C" fn acoshf(x: f32) -> f32 {
1111
let u = x.to_bits();
1212
let a = u & 0x7fffffff;
1313

src/math/asin.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ fn comp_r(z: f64) -> f64 {
6969
/// Returns values in radians, in the range of -pi/2 to pi/2.
7070
#[inline]
7171
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
72-
pub fn asin(mut x: f64) -> f64 {
72+
pub extern "C" fn asin(mut x: f64) -> f64 {
7373
let z: f64;
7474
let r: f64;
7575
let s: f64;

src/math/asinf.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ fn r(z: f32) -> f32 {
3838
/// Returns values in radians, in the range of -pi/2 to pi/2.
3939
#[inline]
4040
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
41-
pub fn asinf(mut x: f32) -> f32 {
41+
pub extern "C" fn asinf(mut x: f32) -> f32 {
4242
let x1p_120 = f64::from_bits(0x3870000000000000); // 0x1p-120 === 2 ^ (-120)
4343

4444
let hx = x.to_bits();

src/math/asinh.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const LN2: f64 = 0.693147180559945309417232121458176568; /* 0x3fe62e42, 0xfefa3
77
///
88
/// Calculates the inverse hyperbolic sine of `x`.
99
/// Is defined as `sgn(x)*log(|x|+sqrt(x*x+1))`.
10-
pub fn asinh(mut x: f64) -> f64 {
10+
pub extern "C" fn asinh(mut x: f64) -> f64 {
1111
let mut u = x.to_bits();
1212
let e = ((u >> 52) as usize) & 0x7ff;
1313
let sign = (u >> 63) != 0;

src/math/asinhf.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const LN2: f32 = 0.693147180559945309417232121458176568;
77
///
88
/// Calculates the inverse hyperbolic sine of `x`.
99
/// Is defined as `sgn(x)*log(|x|+sqrt(x*x+1))`.
10-
pub fn asinhf(mut x: f32) -> f32 {
10+
pub extern "C" fn asinhf(mut x: f32) -> f32 {
1111
let u = x.to_bits();
1212
let i = u & 0x7fffffff;
1313
let sign = (u >> 31) != 0;

src/math/atan.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ const AT: [f64; 11] = [
6666
/// Returns a value in radians, in the range of -pi/2 to pi/2.
6767
#[inline]
6868
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
69-
pub fn atan(x: f64) -> f64 {
69+
pub extern "C" fn atan(x: f64) -> f64 {
7070
let mut x = x;
7171
let mut ix = (x.to_bits() >> 32) as u32;
7272
let sign = ix >> 31;

src/math/atan2.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ const PI_LO: f64 = 1.2246467991473531772E-16; /* 0x3CA1A626, 0x33145C07 */
5050
/// Returns a value in radians, in the range of -pi to pi.
5151
#[inline]
5252
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
53-
pub fn atan2(y: f64, x: f64) -> f64 {
53+
pub extern "C" fn atan2(y: f64, x: f64) -> f64 {
5454
if x.is_nan() || y.is_nan() {
5555
return x + y;
5656
}

src/math/atan2f.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const PI_LO: f32 = -8.7422776573e-08; /* 0xb3bbbd2e */
2626
/// Returns a value in radians, in the range of -pi to pi.
2727
#[inline]
2828
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
29-
pub fn atan2f(y: f32, x: f32) -> f32 {
29+
pub extern "C" fn atan2f(y: f32, x: f32) -> f32 {
3030
if x.is_nan() || y.is_nan() {
3131
return x + y;
3232
}

src/math/atanf.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const A_T: [f32; 5] = [
4343
/// Returns a value in radians, in the range of -pi/2 to pi/2.
4444
#[inline]
4545
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
46-
pub fn atanf(mut x: f32) -> f32 {
46+
pub extern "C" fn atanf(mut x: f32) -> f32 {
4747
let x1p_120 = f32::from_bits(0x03800000); // 0x1p-120 === 2 ^ (-120)
4848

4949
let z: f32;

src/math/atanh.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use super::log1p;
55
///
66
/// Calculates the inverse hyperbolic tangent of `x`.
77
/// Is defined as `log((1+x)/(1-x))/2 = log1p(2x/(1-x))/2`.
8-
pub fn atanh(x: f64) -> f64 {
8+
pub extern "C" fn atanh(x: f64) -> f64 {
99
let u = x.to_bits();
1010
let e = ((u >> 52) as usize) & 0x7ff;
1111
let sign = (u >> 63) != 0;

src/math/atanhf.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use super::log1pf;
55
///
66
/// Calculates the inverse hyperbolic tangent of `x`.
77
/// Is defined as `log((1+x)/(1-x))/2 = log1p(2x/(1-x))/2`.
8-
pub fn atanhf(mut x: f32) -> f32 {
8+
pub extern "C" fn atanhf(mut x: f32) -> f32 {
99
let mut u = x.to_bits();
1010
let sign = (u >> 31) != 0;
1111

src/math/cbrt.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const P4: f64 = 0.145996192886612446982; /* 0x3fc2b000, 0xd4e4edd7 */
3232
/// Computes the cube root of the argument.
3333
#[inline]
3434
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
35-
pub fn cbrt(x: f64) -> f64 {
35+
pub extern "C" fn cbrt(x: f64) -> f64 {
3636
let x1p54 = f64::from_bits(0x4350000000000000); // 0x1p54 === 2 ^ 54
3737

3838
let mut ui: u64 = x.to_bits();

src/math/cbrtf.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const B2: u32 = 642849266; /* B2 = (127-127.0/3-24/3-0.03306235651)*2**23 */
2727
/// Computes the cube root of the argument.
2828
#[inline]
2929
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
30-
pub fn cbrtf(x: f32) -> f32 {
30+
pub extern "C" fn cbrtf(x: f32) -> f32 {
3131
let x1p24 = f32::from_bits(0x4b800000); // 0x1p24f === 2 ^ 24
3232

3333
let mut r: f64;

src/math/ceil.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const TOINT: f64 = 1. / f64::EPSILON;
77
/// Finds the nearest integer greater than or equal to `x`.
88
#[inline]
99
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
10-
pub fn ceil(x: f64) -> f64 {
10+
pub extern "C" fn ceil(x: f64) -> f64 {
1111
// On wasm32 we know that LLVM's intrinsic will compile to an optimized
1212
// `f64.ceil` native instruction, so we can leverage this for both code size
1313
// and speed.

src/math/ceilf.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use core::f32;
55
/// Finds the nearest integer greater than or equal to `x`.
66
#[inline]
77
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
8-
pub fn ceilf(x: f32) -> f32 {
8+
pub extern "C" fn ceilf(x: f32) -> f32 {
99
// On wasm32 we know that LLVM's intrinsic will compile to an optimized
1010
// `f32.ceil` native instruction, so we can leverage this for both code size
1111
// and speed.

src/math/copysign.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
///
33
/// Constructs a number with the magnitude (absolute value) of its
44
/// first argument, `x`, and the sign of its second argument, `y`.
5-
pub fn copysign(x: f64, y: f64) -> f64 {
5+
pub extern "C" fn copysign(x: f64, y: f64) -> f64 {
66
let mut ux = x.to_bits();
77
let uy = y.to_bits();
88
ux &= (!0) >> 1;

src/math/copysignf.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
///
33
/// Constructs a number with the magnitude (absolute value) of its
44
/// first argument, `x`, and the sign of its second argument, `y`.
5-
pub fn copysignf(x: f32, y: f32) -> f32 {
5+
pub extern "C" fn copysignf(x: f32, y: f32) -> f32 {
66
let mut ux = x.to_bits();
77
let uy = y.to_bits();
88
ux &= 0x7fffffff;

src/math/cos.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ use super::{k_cos, k_sin, rem_pio2};
4343
//
4444
#[inline]
4545
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
46-
pub fn cos(x: f64) -> f64 {
46+
pub extern "C" fn cos(x: f64) -> f64 {
4747
let ix = (f64::to_bits(x) >> 32) as u32 & 0x7fffffff;
4848

4949
/* |x| ~< pi/4 */

src/math/cosf.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const C4_PIO2: f64 = 4. * FRAC_PI_2; /* 0x401921FB, 0x54442D18 */
2626

2727
#[inline]
2828
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
29-
pub fn cosf(x: f32) -> f32 {
29+
pub extern "C" fn cosf(x: f32) -> f32 {
3030
let x64 = x as f64;
3131

3232
let x1p120 = f32::from_bits(0x7b800000); // 0x1p120f === 2 ^ 120

src/math/cosh.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use super::k_expo2;
99
/// Angles are specified in radians.
1010
#[inline]
1111
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
12-
pub fn cosh(mut x: f64) -> f64 {
12+
pub extern "C" fn cosh(mut x: f64) -> f64 {
1313
/* |x| */
1414
let mut ix = x.to_bits();
1515
ix &= 0x7fffffffffffffff;

src/math/coshf.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use super::k_expo2f;
99
/// Angles are specified in radians.
1010
#[inline]
1111
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
12-
pub fn coshf(mut x: f32) -> f32 {
12+
pub extern "C" fn coshf(mut x: f32) -> f32 {
1313
let x1p120 = f32::from_bits(0x7b800000); // 0x1p120f === 2 ^ 120
1414

1515
/* |x| */

src/math/erf.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ fn erfc2(ix: u32, mut x: f64) -> f64 {
219219
/// Calculates an approximation to the “error function”, which estimates
220220
/// the probability that an observation will fall within x standard
221221
/// deviations of the mean (assuming a normal distribution).
222-
pub fn erf(x: f64) -> f64 {
222+
pub extern "C" fn erf(x: f64) -> f64 {
223223
let r: f64;
224224
let s: f64;
225225
let z: f64;
@@ -268,7 +268,7 @@ pub fn erf(x: f64) -> f64 {
268268
/// Is `1 - erf(x)`. Is computed directly, so that you can use it to avoid
269269
/// the loss of precision that would result from subtracting
270270
/// large probabilities (on large `x`) from 1.
271-
pub fn erfc(x: f64) -> f64 {
271+
pub extern "C" fn erfc(x: f64) -> f64 {
272272
let r: f64;
273273
let s: f64;
274274
let z: f64;

src/math/erff.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ fn erfc2(mut ix: u32, mut x: f32) -> f32 {
130130
/// Calculates an approximation to the “error function”, which estimates
131131
/// the probability that an observation will fall within x standard
132132
/// deviations of the mean (assuming a normal distribution).
133-
pub fn erff(x: f32) -> f32 {
133+
pub extern "C" fn erff(x: f32) -> f32 {
134134
let r: f32;
135135
let s: f32;
136136
let z: f32;
@@ -179,7 +179,7 @@ pub fn erff(x: f32) -> f32 {
179179
/// Is `1 - erf(x)`. Is computed directly, so that you can use it to avoid
180180
/// the loss of precision that would result from subtracting
181181
/// large probabilities (on large `x`) from 1.
182-
pub fn erfcf(x: f32) -> f32 {
182+
pub extern "C" fn erfcf(x: f32) -> f32 {
183183
let r: f32;
184184
let s: f32;
185185
let z: f32;

src/math/exp.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ const P5: f64 = 4.13813679705723846039e-08; /* 0x3E663769, 0x72BEA4D0 */
8383
/// (where *e* is the base of the natural system of logarithms, approximately 2.71828).
8484
#[inline]
8585
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
86-
pub fn exp(mut x: f64) -> f64 {
86+
pub extern "C" fn exp(mut x: f64) -> f64 {
8787
let x1p1023 = f64::from_bits(0x7fe0000000000000); // 0x1p1023 === 2 ^ 1023
8888
let x1p_149 = f64::from_bits(0x36a0000000000000); // 0x1p-149 === 2 ^ -149
8989

src/math/exp10.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const P10: &[f64] = &[
66
1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13, 1e14, 1e15,
77
];
88

9-
pub fn exp10(x: f64) -> f64 {
9+
pub extern "C" fn exp10(x: f64) -> f64 {
1010
let (mut y, n) = modf(x);
1111
let u: u64 = n.to_bits();
1212
/* fabs(n) < 16 without raising invalid on nan */

src/math/exp10f.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const P10: &[f32] = &[
66
1e-7, 1e-6, 1e-5, 1e-4, 1e-3, 1e-2, 1e-1, 1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7,
77
];
88

9-
pub fn exp10f(x: f32) -> f32 {
9+
pub extern "C" fn exp10f(x: f32) -> f32 {
1010
let (mut y, n) = modff(x);
1111
let u = n.to_bits();
1212
/* fabsf(n) < 8 without raising invalid on nan */

src/math/exp2.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ static TBL: [u64; TBLSIZE * 2] = [
324324
/// Calculate `2^x`, that is, 2 raised to the power `x`.
325325
#[inline]
326326
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
327-
pub fn exp2(mut x: f64) -> f64 {
327+
pub extern "C" fn exp2(mut x: f64) -> f64 {
328328
let redux = f64::from_bits(0x4338000000000000) / TBLSIZE as f64;
329329
let p1 = f64::from_bits(0x3fe62e42fefa39ef);
330330
let p2 = f64::from_bits(0x3fcebfbdff82c575);

src/math/exp2f.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ static EXP2FT: [u64; TBLSIZE] = [
7575
/// Calculate `2^x`, that is, 2 raised to the power `x`.
7676
#[inline]
7777
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
78-
pub fn exp2f(mut x: f32) -> f32 {
78+
pub extern "C" fn exp2f(mut x: f32) -> f32 {
7979
let redux = f32::from_bits(0x4b400000) / TBLSIZE as f32;
8080
let p1 = f32::from_bits(0x3f317218);
8181
let p2 = f32::from_bits(0x3e75fdf0);

src/math/expf.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const P2: f32 = -2.7667332906e-3; /* -0xb55215.0p-32 */
3232
/// (where *e* is the base of the natural system of logarithms, approximately 2.71828).
3333
#[inline]
3434
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
35-
pub fn expf(mut x: f32) -> f32 {
35+
pub extern "C" fn expf(mut x: f32) -> f32 {
3636
let x1p127 = f32::from_bits(0x7f000000); // 0x1p127f === 2 ^ 127
3737
let x1p_126 = f32::from_bits(0x800000); // 0x1p-126f === 2 ^ -126 /*original 0x1p-149f ??????????? */
3838
let mut hx = x.to_bits();

src/math/expm1.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const Q5: f64 = -2.01099218183624371326e-07; /* BE8AFDB7 6E09C32D */
3232
/// where using `exp(x)-1` would lose many significant digits.
3333
#[inline]
3434
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
35-
pub fn expm1(mut x: f64) -> f64 {
35+
pub extern "C" fn expm1(mut x: f64) -> f64 {
3636
let hi: f64;
3737
let lo: f64;
3838
let k: i32;

src/math/expm1f.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const Q2: f32 = 1.5807170421e-3; /* 0xcf3010.0p-33 */
3434
/// where using `exp(x)-1` would lose many significant digits.
3535
#[inline]
3636
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
37-
pub fn expm1f(mut x: f32) -> f32 {
37+
pub extern "C" fn expm1f(mut x: f32) -> f32 {
3838
let x1p127 = f32::from_bits(0x7f000000); // 0x1p127f === 2 ^ 127
3939

4040
let mut hx = x.to_bits();

src/math/fabs.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use core::u64;
55
/// by direct manipulation of the bit representation of `x`.
66
#[inline]
77
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
8-
pub fn fabs(x: f64) -> f64 {
8+
pub extern "C" fn fabs(x: f64) -> f64 {
99
// On wasm32 we know that LLVM's intrinsic will compile to an optimized
1010
// `f64.abs` native instruction, so we can leverage this for both code size
1111
// and speed.

src/math/fabsf.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/// by direct manipulation of the bit representation of `x`.
44
#[inline]
55
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
6-
pub fn fabsf(x: f32) -> f32 {
6+
pub extern "C" fn fabsf(x: f32) -> f32 {
77
// On wasm32 we know that LLVM's intrinsic will compile to an optimized
88
// `f32.abs` native instruction, so we can leverage this for both code size
99
// and speed.

src/math/fdim.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use core::f64;
1010
/// A range error may occur.
1111
#[inline]
1212
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
13-
pub fn fdim(x: f64, y: f64) -> f64 {
13+
pub extern "C" fn fdim(x: f64, y: f64) -> f64 {
1414
if x.is_nan() {
1515
x
1616
} else if y.is_nan() {

src/math/fdimf.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use core::f32;
1010
/// A range error may occur.
1111
#[inline]
1212
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
13-
pub fn fdimf(x: f32, y: f32) -> f32 {
13+
pub extern "C" fn fdimf(x: f32, y: f32) -> f32 {
1414
if x.is_nan() {
1515
x
1616
} else if y.is_nan() {

src/math/floor.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const TOINT: f64 = 1. / f64::EPSILON;
77
/// Finds the nearest integer less than or equal to `x`.
88
#[inline]
99
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
10-
pub fn floor(x: f64) -> f64 {
10+
pub extern "C" fn floor(x: f64) -> f64 {
1111
// On wasm32 we know that LLVM's intrinsic will compile to an optimized
1212
// `f64.floor` native instruction, so we can leverage this for both code size
1313
// and speed.

src/math/floorf.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use core::f32;
55
/// Finds the nearest integer less than or equal to `x`.
66
#[inline]
77
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
8-
pub fn floorf(x: f32) -> f32 {
8+
pub extern "C" fn floorf(x: f32) -> f32 {
99
// On wasm32 we know that LLVM's intrinsic will compile to an optimized
1010
// `f32.floor` native instruction, so we can leverage this for both code size
1111
// and speed.

src/math/fma.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ fn mul(x: u64, y: u64) -> (u64, u64) {
5555
/// according to the rounding mode characterized by the value of FLT_ROUNDS.
5656
#[inline]
5757
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
58-
pub fn fma(x: f64, y: f64, z: f64) -> f64 {
58+
pub extern "C" fn fma(x: f64, y: f64, z: f64) -> f64 {
5959
let x1p63: f64 = f64::from_bits(0x43e0000000000000); // 0x1p63 === 2 ^ 63
6060
let x0_ffffff8p_63 = f64::from_bits(0x3bfffffff0000000); // 0x0.ffffff8p-63
6161

src/math/fmaf.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ use super::fenv::{
4848
/// according to the rounding mode characterized by the value of FLT_ROUNDS.
4949
#[inline]
5050
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
51-
pub fn fmaf(x: f32, y: f32, mut z: f32) -> f32 {
51+
pub extern "C" fn fmaf(x: f32, y: f32, mut z: f32) -> f32 {
5252
let xy: f64;
5353
let mut result: f64;
5454
let mut ui: u64;

0 commit comments

Comments
 (0)