From 79011171cb690359c6714da2c7da742338f71176 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Thu, 22 Aug 2024 19:47:07 -0700 Subject: [PATCH] zeroes: use ArrayVec::from_iter instead of helper function --- src/zeroes.rs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/zeroes.rs b/src/zeroes.rs index 8ace8dc..0117963 100644 --- a/src/zeroes.rs +++ b/src/zeroes.rs @@ -2,12 +2,6 @@ use arrayvec::ArrayVec; use crate::integer::Planar64; -fn one(z0:Planar64)->ArrayVec{ - let mut zeroes=ArrayVec::new(); - unsafe{zeroes.push_unchecked(z0)} - zeroes -} - #[inline] pub fn zeroes2(a0:Planar64,a1:Planar64,a2:Planar64)->ArrayVec{ if a2==Planar64::ZERO{ @@ -27,7 +21,7 @@ pub fn zeroes2(a0:Planar64,a1:Planar64,a2:Planar64)->ArrayVec{ (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{ }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(); }