From 2ee041ff66d0b8c38a8452a40a7800e70eb1297e Mon Sep 17 00:00:00 2001 From: Quaternions Date: Wed, 7 Feb 2024 19:45:51 -0800 Subject: [PATCH] const --- src/integer.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/integer.rs b/src/integer.rs index 735a051..71383bc 100644 --- a/src/integer.rs +++ b/src/integer.rs @@ -296,7 +296,7 @@ impl Angle32{ pub const FRAC_PI_2:Self=Self(1<<30); pub const PI:Self=Self(-1<<31); #[inline] - pub fn wrap_from_i64(theta:i64)->Self{ + pub const fn wrap_from_i64(theta:i64)->Self{ //take lower bits //note: this was checked on compiler explorer and compiles to 1 instruction! Self(i32::from_ne_bytes(((theta&((1<<32)-1)) as u32).to_ne_bytes())) @@ -308,7 +308,7 @@ impl Angle32{ Self(theta.clamp(i32::MIN as i64,i32::MAX as i64) as i32) } #[inline] - pub fn get(&self)->i32{ + pub const fn get(&self)->i32{ self.0 } /// Clamps the value towards the midpoint of the range.