const
This commit is contained in:
parent
f8be75a3fc
commit
2ee041ff66
@ -296,7 +296,7 @@ impl Angle32{
|
|||||||
pub const FRAC_PI_2:Self=Self(1<<30);
|
pub const FRAC_PI_2:Self=Self(1<<30);
|
||||||
pub const PI:Self=Self(-1<<31);
|
pub const PI:Self=Self(-1<<31);
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn wrap_from_i64(theta:i64)->Self{
|
pub const fn wrap_from_i64(theta:i64)->Self{
|
||||||
//take lower bits
|
//take lower bits
|
||||||
//note: this was checked on compiler explorer and compiles to 1 instruction!
|
//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()))
|
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)
|
Self(theta.clamp(i32::MIN as i64,i32::MAX as i64) as i32)
|
||||||
}
|
}
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn get(&self)->i32{
|
pub const fn get(&self)->i32{
|
||||||
self.0
|
self.0
|
||||||
}
|
}
|
||||||
/// Clamps the value towards the midpoint of the range.
|
/// Clamps the value towards the midpoint of the range.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user