From 0463cb901a31ce18ac0129845f2cb57ce9108718 Mon Sep 17 00:00:00 2001 From: fwcd Date: Sat, 6 Apr 2019 23:28:20 +0200 Subject: [PATCH] Reimplement 'zernum' using indices --- src/CalcManager/Ratpack/num.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/CalcManager/Ratpack/num.cpp b/src/CalcManager/Ratpack/num.cpp index be7894b8..36385828 100644 --- a/src/CalcManager/Ratpack/num.cpp +++ b/src/CalcManager/Ratpack/num.cpp @@ -631,11 +631,14 @@ bool lessnum( PNUMBER a, PNUMBER b ) bool zernum( PNUMBER a ) { + int32_t length = a->cdigit; + int32_t index = 0; + // loop over all the digits until you find a nonzero or until you run // out of digits - for ( MANTTYPE digit : a->mant ) + while ( length-- > 0 ) { - if ( digit ) + if ( a->mant[index++] ) { // One of the digits isn't zero, therefore the number isn't zero return false;