From a9887119187a3a62c9ce27edff02965b9dfd490b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20A=2E=20Ortega?= Date: Thu, 16 Mar 2017 14:59:53 +0100 Subject: [PATCH] Fixed progress measurement. --- src/files.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/files.c b/src/files.c index 2d9f2dd..74f5119 100644 --- a/src/files.c +++ b/src/files.c @@ -51,9 +51,9 @@ int outputPrimes(char *file, List *list, size_t startPos) { puts("0%"); for(size_t i = startPos; i < list->end; ++i) { if(!mpz_out_raw(out, list->list[i])) return 3; - if(i == list->end / 4) puts("25%"); - else if(i == list->end / 2) puts("50%"); - else if(i == list->end * 3 / 4) puts("75%"); + if(i - startPos == (list->end - startPos) / 4) puts("25%"); + else if(i - startPos == (list->end - startPos) / 2) puts("50%"); + else if(i - startPos == (list->end - startPos) * 3 / 4) puts("75%"); } puts("100%");