Skip to content

Commit 61d958f

Browse files
104: add more #[inline] r=japaric a=erikdesjardins Some of these are pretty big so they may not get inlined in practice, but we might as well make them consistent with the rest. Co-authored-by: Erik <[email protected]>
2 parents 4e7504a + f1172af commit 61d958f

File tree

12 files changed

+12
-0
lines changed

12 files changed

+12
-0
lines changed

src/math/ceilf.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use core::f32;
22

3+
#[inline]
34
pub fn ceilf(x: f32) -> f32 {
45
let mut ui = x.to_bits();
56
let e = (((ui >> 23) & 0xff) - 0x7f) as i32;

src/math/exp2.rs

+1
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@ static TBL: [u64; TBLSIZE * 2] = [
318318
//
319319
// Gal, S. and Bachelis, B. An Accurate Elementary Mathematical Library
320320
// for the IEEE Floating Point Standard. TOMS 17(1), 26-46 (1991).
321+
#[inline]
321322
pub fn exp2(mut x: f64) -> f64 {
322323
let redux = f64::from_bits(0x4338000000000000) / TBLSIZE as f64;
323324
let p1 = f64::from_bits(0x3fe62e42fefa39ef);

src/math/exp2f.rs

+1
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ static EXP2FT: [u64; TBLSIZE] = [
6969
//
7070
// Tang, P. Table-driven Implementation of the Exponential Function
7171
// in IEEE Floating-Point Arithmetic. TOMS 15(2), 144-157 (1989).
72+
#[inline]
7273
pub fn exp2f(mut x: f32) -> f32 {
7374
let redux = f32::from_bits(0x4b400000) / TBLSIZE as f32;
7475
let p1 = f32::from_bits(0x3f317218);

src/math/fdim.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use core::f64;
22

3+
#[inline]
34
pub fn fdim(x: f64, y: f64) -> f64 {
45
if x.is_nan() {
56
x

src/math/fdimf.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use core::f32;
22

3+
#[inline]
34
pub fn fdimf(x: f32, y: f32) -> f32 {
45
if x.is_nan() {
56
x

src/math/hypot.rs

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use super::sqrt;
44

55
const SPLIT: f64 = 134217728. + 1.; // 0x1p27 + 1 === (2 ^ 27) + 1
66

7+
#[inline]
78
fn sq(x: f64) -> (f64, f64) {
89
let xh: f64;
910
let xl: f64;

src/math/log1p.rs

+1
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ const LG5: f64 = 1.818357216161805012e-01; /* 3FC74664 96CB03DE */
6565
const LG6: f64 = 1.531383769920937332e-01; /* 3FC39A09 D078C69F */
6666
const LG7: f64 = 1.479819860511658591e-01; /* 3FC2F112 DF3E5244 */
6767

68+
#[inline]
6869
pub fn log1p(x: f64) -> f64 {
6970
let mut ui: u64 = x.to_bits();
7071
let hfsq: f64;

src/math/log1pf.rs

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ const LG2: f32 = 0.40000972152; /* 0xccce13.0p-25 */
2020
const LG3: f32 = 0.28498786688; /* 0x91e9ee.0p-25 */
2121
const LG4: f32 = 0.24279078841; /* 0xf89e26.0p-26 */
2222

23+
#[inline]
2324
pub fn log1pf(x: f32) -> f32 {
2425
let mut ui: u32 = x.to_bits();
2526
let hfsq: f32;

src/math/log2.rs

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ const LG5: f64 = 1.818357216161805012e-01; /* 3FC74664 96CB03DE */
2929
const LG6: f64 = 1.531383769920937332e-01; /* 3FC39A09 D078C69F */
3030
const LG7: f64 = 1.479819860511658591e-01; /* 3FC2F112 DF3E5244 */
3131

32+
#[inline]
3233
pub fn log2(mut x: f64) -> f64 {
3334
let x1p54 = f64::from_bits(0x4350000000000000); // 0x1p54 === 2 ^ 54
3435

src/math/log2f.rs

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const LG2: f32 = 0.40000972152; /* 0xccce13.0p-25 */
2323
const LG3: f32 = 0.28498786688; /* 0x91e9ee.0p-25 */
2424
const LG4: f32 = 0.24279078841; /* 0xf89e26.0p-26 */
2525

26+
#[inline]
2627
pub fn log2f(mut x: f32) -> f32 {
2728
let x1p25f = f32::from_bits(0x4c000000); // 0x1p25f === 2 ^ 25
2829

src/math/round.rs

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use core::f64;
22

33
const TOINT: f64 = 1.0 / f64::EPSILON;
44

5+
#[inline]
56
pub fn round(mut x: f64) -> f64 {
67
let (f, i) = (x, x.to_bits());
78
let e: u64 = i >> 52 & 0x7ff;

src/math/roundf.rs

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use core::f32;
22

33
const TOINT: f32 = 1.0 / f32::EPSILON;
44

5+
#[inline]
56
pub fn roundf(mut x: f32) -> f32 {
67
let i = x.to_bits();
78
let e: u32 = i >> 23 & 0xff;

0 commit comments

Comments
 (0)