From e297e82fb26ef48dfdb45c509e9d5f3e8251f371 Mon Sep 17 00:00:00 2001 From: fwcd Date: Sat, 6 Apr 2019 19:18:39 +0200 Subject: [PATCH] Iterate over the mantissa vector directly in zernum(PNUMBER) --- src/CalcManager/Ratpack/num.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/CalcManager/Ratpack/num.cpp b/src/CalcManager/Ratpack/num.cpp index a9f4b10d..d56757fe 100644 --- a/src/CalcManager/Ratpack/num.cpp +++ b/src/CalcManager/Ratpack/num.cpp @@ -635,16 +635,11 @@ bool lessnum( PNUMBER a, PNUMBER b ) bool zernum( PNUMBER a ) { - int32_t length; - vector::iterator pcha; - length = a->cdigit; - pcha = a->mant.begin(); - // loop over all the digits until you find a nonzero or until you run // out of digits - while ( length-- > 0 ) + for ( MANTTYPE digit : a->mant ) { - if ( *pcha++ ) + if ( digit ) { // One of the digits isn't zero, therefore the number isn't zero return false;