diff --git a/src/list.c b/src/list.c index de163b3..8801b02 100644 --- a/src/list.c +++ b/src/list.c @@ -25,7 +25,7 @@ void deInitList(List *l) { } void addToList(List *l, mpz_t n) { - if(l->end == l->size) { + if(unlikely(l->end == l->size)) { l->size += BLOCK_SIZE; if(unlikely(l->size == 0)) { fprintf(stderr, @@ -33,7 +33,7 @@ void addToList(List *l, mpz_t n) { exit(1); } void *tmp = realloc(l->list, sizeof(mpz_t) * l->size); - if(!tmp) { + if(unlikely(!tmp)) { fprintf(stderr, "Failed to allocate more memory to list!\n"); exit(1); } diff --git a/src/main.c b/src/main.c index 42a3d67..79404e7 100644 --- a/src/main.c +++ b/src/main.c @@ -5,6 +5,7 @@ #include #include "list.h" +#include "optimizers.h" static bool run; void leave(); @@ -27,7 +28,7 @@ int main(void) { // Add 2, a known prime to this list mpz_set_ui(num, 2); addToList(&primes, num); - if(mpz_out_str(stdout, 10, num) == 0) { + if(unlikely(mpz_out_str(stdout, 10, num) == 0)) { fprintf(stderr, "Could not print to `stdout'!\n"); exit(1); } @@ -43,7 +44,7 @@ int main(void) { // `num' is a prime so we add it to the list and print it addToList(&primes, num); - if(mpz_out_str(stdout, 10, num) == 0) { + if(unlikely(mpz_out_str(stdout, 10, num) == 0)) { fprintf(stderr, "Could not print to `stdout'!\n"); exit(1); }