about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--numericx.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/numericx.c b/numericx.c
index b8c0254..287b6d0 100644
--- a/numericx.c
+++ b/numericx.c
@@ -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);