mach: Timer: mark all wrapper functions as inline

This commit is contained in:
iddev5 2022-05-23 12:40:59 +05:30 committed by Stephen Gutekanst
parent f64595393b
commit 9b7b8be285

View file

@ -38,26 +38,26 @@ pub fn start() !Timer {
} }
/// Reads the timer value since start or the last reset in nanoseconds. /// Reads the timer value since start or the last reset in nanoseconds.
pub fn readPrecise(timer: *Timer) u64 { pub inline fn readPrecise(timer: *Timer) u64 {
return timer.backing_timer.read(); return timer.backing_timer.read();
} }
/// Reads the timer value since start or the last reset in seconds. /// Reads the timer value since start or the last reset in seconds.
pub fn read(timer: *Timer) f32 { pub inline fn read(timer: *Timer) f32 {
return @intToFloat(f32, timer.readPrecise()) / @intToFloat(f32, std.time.ns_per_s); return @intToFloat(f32, timer.readPrecise()) / @intToFloat(f32, std.time.ns_per_s);
} }
/// Resets the timer value to 0/now. /// Resets the timer value to 0/now.
pub fn reset(timer: *Timer) void { pub inline fn reset(timer: *Timer) void {
timer.backing_timer.reset(); timer.backing_timer.reset();
} }
/// Returns the current value of the timer in nanoseconds, then resets it. /// Returns the current value of the timer in nanoseconds, then resets it.
pub fn lapPrecise(timer: *Timer) u64 { pub inline fn lapPrecise(timer: *Timer) u64 {
return timer.backing_timer.lap(); return timer.backing_timer.lap();
} }
/// Returns the current value of the timer in seconds, then resets it. /// Returns the current value of the timer in seconds, then resets it.
pub fn lap(timer: *Timer) f32 { pub inline fn lap(timer: *Timer) f32 {
return @intToFloat(f32, timer.lapPrecise()) / @intToFloat(f32, std.time.ns_per_s); return @intToFloat(f32, timer.lapPrecise()) / @intToFloat(f32, std.time.ns_per_s);
} }