mirror of
https://github.com/emilk/egui.git
synced 2026-08-31 13:50:04 -04:00
Optimize: add #[inline(always)] to various low-level things
saves up to 20% (text tesselation), and at least 5% overall
This commit is contained in:
@@ -20,9 +20,13 @@ macro_rules! impl_numeric_float {
|
||||
const INTEGRAL: bool = false;
|
||||
const MIN: Self = std::$t::MIN;
|
||||
const MAX: Self = std::$t::MAX;
|
||||
|
||||
#[inline(always)]
|
||||
fn to_f64(self) -> f64 {
|
||||
self as f64
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn from_f64(num: f64) -> Self {
|
||||
num as Self
|
||||
}
|
||||
@@ -36,9 +40,13 @@ macro_rules! impl_numeric_integer {
|
||||
const INTEGRAL: bool = true;
|
||||
const MIN: Self = std::$t::MIN;
|
||||
const MAX: Self = std::$t::MAX;
|
||||
|
||||
#[inline(always)]
|
||||
fn to_f64(self) -> f64 {
|
||||
self as f64
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn from_f64(num: f64) -> Self {
|
||||
num as Self
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user