minor optimization for main cycle
* optimizes main counting cycle if TO_INFINITE_BASE is set, by adding to_second variable Signed-off-by: Daniel Santos <dacs.git@brilhante.top>
This commit is contained in:
parent
a1447b807b
commit
2dd0e8663e
|
@ -280,6 +280,12 @@ main(int argc, char* argv[])
|
|||
increment(result, to_first, to_last, to_first);
|
||||
}
|
||||
|
||||
/* minor optimization for the cycle below */
|
||||
char* to_second = NULL;
|
||||
|
||||
if( TO_INFINITE_BASE )
|
||||
to_second = to_first + 1;
|
||||
|
||||
/* increments until it finishes */
|
||||
while( !is_the_same(counting, number) )
|
||||
{
|
||||
|
@ -287,7 +293,7 @@ main(int argc, char* argv[])
|
|||
print_numeral(result);
|
||||
|
||||
if( TO_INFINITE_BASE )
|
||||
increment(result, to_first, to_last, (to_first + 1));
|
||||
increment(result, to_first, to_last, to_second);
|
||||
else
|
||||
increment(result, to_first, to_last, to_first);
|
||||
|
||||
|
|
Loading…
Reference in New Issue