zeroes: use ArrayVec::from_iter instead of helper function
This commit is contained in:
parent
cd58e20fc2
commit
79011171cb
@ -2,12 +2,6 @@
|
||||
use arrayvec::ArrayVec;
|
||||
use crate::integer::Planar64;
|
||||
|
||||
fn one(z0:Planar64)->ArrayVec<Planar64,2>{
|
||||
let mut zeroes=ArrayVec::new();
|
||||
unsafe{zeroes.push_unchecked(z0)}
|
||||
zeroes
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn zeroes2(a0:Planar64,a1:Planar64,a2:Planar64)->ArrayVec<Planar64,2>{
|
||||
if a2==Planar64::ZERO{
|
||||
@ -27,7 +21,7 @@ pub fn zeroes2(a0:Planar64,a1:Planar64,a2:Planar64)->ArrayVec<Planar64,2>{
|
||||
(false,false)=>[(-a1+planar_radicand)/(a2*2),(a0*2)/(-a1+planar_radicand)].into(),
|
||||
}
|
||||
}else if radicand==0{
|
||||
return one(a1/(a2*-2));
|
||||
return ArrayVec::from_iter([a1/(a2*-2)]);
|
||||
}else{
|
||||
return ArrayVec::new_const();
|
||||
}
|
||||
@ -39,7 +33,7 @@ pub fn zeroes1(a0:Planar64,a1:Planar64)->ArrayVec<Planar64,2>{
|
||||
}else{
|
||||
let q=((-a0.get() as i128)<<32)/(a1.get() as i128);
|
||||
if i64::MIN as i128<=q&&q<=i64::MAX as i128{
|
||||
return one(Planar64::raw(q as i64));
|
||||
return ArrayVec::from_iter([Planar64::raw(q as i64)]);
|
||||
}else{
|
||||
return ArrayVec::new_const();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user