lol idk #1

Open
Quaternions wants to merge 826 commits from StrafesNET/strafe-project:master into master
Showing only changes of commit 491de52f17 - Show all commits

View File

@ -155,24 +155,23 @@ impl_shift_operator!( Fixed, Shr, shr, Self );
impl<const CHUNKS:usize,Frac:Unsigned> Fixed<CHUNKS,Frac>{
pub fn sqrt_unchecked(self)->Self{
let mut pow2=if self==Self::ZERO{
return Self::ZERO;
}else if self<Self::ONE{
//find pow2 more powerful than self
//find pow2 more powerful than self
let mut pow2=if Self::ONE<self{
let mut pow2=Self::TWO;//1<self is so bake one iteration
while pow2<=self{
pow2<<=1;
}
pow2
}else if Self::ONE==self{
return Self::ONE;
}else if Self::ZERO<self{
let mut pow2=Self::ONE;
while self<=pow2{
pow2>>=1;
}
pow2
}else if self==Self::ONE{
return Self::ONE;
}else{
//find pow2 more powerful than self
let mut pow2=Self::ONE;
while pow2<=self{
pow2<<=1;
}
pow2
}else{//either 0==self or self is negative
return Self::ZERO;
};
let mut result=pow2;
while pow2!=Self::ZERO{