Add inlines for basic functions in fixnum which weren't being inlined

This commit is contained in:
Gwilym Kuiper 2022-03-05 18:42:40 +00:00
parent 60977b7d2d
commit 8010b2661a

View file

@ -68,15 +68,19 @@ pub trait FixedWidthSignedInteger: FixedWidthUnsignedInteger + Neg<Output = Self
macro_rules! fixed_width_unsigned_integer_impl { macro_rules! fixed_width_unsigned_integer_impl {
($T: ty) => { ($T: ty) => {
impl FixedWidthUnsignedInteger for $T { impl FixedWidthUnsignedInteger for $T {
#[inline(always)]
fn zero() -> Self { fn zero() -> Self {
0 0
} }
#[inline(always)]
fn one() -> Self { fn one() -> Self {
1 1
} }
#[inline(always)]
fn ten() -> Self { fn ten() -> Self {
10 10
} }
#[inline(always)]
fn from_as_i32(v: i32) -> Self { fn from_as_i32(v: i32) -> Self {
v as $T v as $T
} }
@ -87,6 +91,7 @@ macro_rules! fixed_width_unsigned_integer_impl {
macro_rules! fixed_width_signed_integer_impl { macro_rules! fixed_width_signed_integer_impl {
($T: ty) => { ($T: ty) => {
impl FixedWidthSignedInteger for $T { impl FixedWidthSignedInteger for $T {
#[inline(always)]
fn fixed_abs(self) -> Self { fn fixed_abs(self) -> Self {
self.abs() self.abs()
} }