mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-22 14:13:30 -07:00
Reimplement 'zernum' using indices
This commit is contained in:
parent
32e700c952
commit
0463cb901a
1 changed files with 5 additions and 2 deletions
|
@ -631,11 +631,14 @@ bool lessnum( PNUMBER a, PNUMBER b )
|
||||||
bool zernum( PNUMBER a )
|
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
|
// loop over all the digits until you find a nonzero or until you run
|
||||||
// out of digits
|
// 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
|
// One of the digits isn't zero, therefore the number isn't zero
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue