Skip to content

Commit 61aabd8

Browse files
committed
Added inline to FromPrimitive methods
Closes #2
1 parent c05ddde commit 61aabd8

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22

33
name = "piston-float"
4-
version = "0.0.0"
4+
version = "0.0.1"
55
authors = ["bvssvni <bvssvni@gmail.com>"]
66
keywords = ["float", "piston"]
77
description = "Traits for generic floats in game development"

src/lib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,14 +272,20 @@ pub trait FromPrimitive {
272272
}
273273

274274
impl FromPrimitive for f64 {
275+
#[inline(always)]
275276
fn from_f64(t: f64) -> Self { t }
277+
#[inline(always)]
276278
fn from_f32(t: f32) -> Self { t as f64 }
279+
#[inline(always)]
277280
fn from_isize(t: isize) -> Self { t as f64 }
278281
}
279282

280283
impl FromPrimitive for f32 {
284+
#[inline(always)]
281285
fn from_f64(t: f64) -> Self { t as f32 }
286+
#[inline(always)]
282287
fn from_f32(t: f32) -> Self { t }
288+
#[inline(always)]
283289
fn from_isize(t: isize) -> Self { t as f32 }
284290
}
285291

0 commit comments

Comments
 (0)