diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/allocator.c | 2 | ||||
| -rw-r--r-- | src/internals.h | 4 | ||||
| -rw-r--r-- | src/zdivmod.c | 4 | ||||
| -rw-r--r-- | src/zmodpow.c | 2 | ||||
| -rw-r--r-- | src/zmodpowu.c | 2 | ||||
| -rw-r--r-- | src/zrand.c | 6 | ||||
| -rw-r--r-- | src/zsets.c | 4 | ||||
| -rw-r--r-- | src/zsetup.c | 2 |
8 files changed, 13 insertions, 13 deletions
diff --git a/src/allocator.c b/src/allocator.c index 1a2d505..4f81171 100644 --- a/src/allocator.c +++ b/src/allocator.c @@ -22,7 +22,7 @@ libzahl_realloc(z_t a, size_t need) a->chars = new; } else { a->chars = realloc(a->chars, new_size * sizeof(zahl_char_t)); - if (check(unlikely(!a->chars))) + if (check(!a->chars)) libzahl_memfailure(); } a->alloced = new_size; diff --git a/src/internals.h b/src/internals.h index c59b792..b055dbd 100644 --- a/src/internals.h +++ b/src/internals.h @@ -100,7 +100,7 @@ extern void *libzahl_temp_allocation; #if defined(UNSAFE) # define check(expr) 0 #else -# define check(expr) (expr) +# define check(expr) unlikely(expr) #endif #define SET_SIGNUM(a, signum) ZAHL_SET_SIGNUM(a, signum) @@ -337,7 +337,7 @@ zinit_temp(z_t a) size_t n = (size_t)(libzahl_temp_stack_end - libzahl_temp_stack); void* old = libzahl_temp_stack; libzahl_temp_stack = realloc(old, 2 * n * sizeof(*libzahl_temp_stack)); - if (check(unlikely(!libzahl_temp_stack))) { + if (check(!libzahl_temp_stack)) { libzahl_temp_stack = old; libzahl_memfailure(); } diff --git a/src/zdivmod.c b/src/zdivmod.c index 9cf3611..dae0e02 100644 --- a/src/zdivmod.c +++ b/src/zdivmod.c @@ -72,9 +72,9 @@ zdivmod(z_t a, z_t b, z_t c, z_t d) sign = zsignum(c) * zsignum(d); if (unlikely(!sign)) { - if (check(unlikely(!zzero(c)))) { + if (check(!zzero(c))) { libzahl_failure(-ZERROR_DIV_0); - } else if (check(unlikely(zzero(d)))) { + } else if (check(zzero(d))) { libzahl_failure(-ZERROR_0_DIV_0); } else { SET_SIGNUM(a, 0); diff --git a/src/zmodpow.c b/src/zmodpow.c index 34e687f..0cec96d 100644 --- a/src/zmodpow.c +++ b/src/zmodpow.c @@ -25,7 +25,7 @@ zmodpow(z_t a, z_t b, z_t c, z_t d) SET_SIGNUM(a, 0); } return; - } else if (check(unlikely(zzero(d)))) { + } else if (check(zzero(d))) { libzahl_failure(-ZERROR_DIV_0); } else if (unlikely(zzero(b))) { SET_SIGNUM(a, 0); diff --git a/src/zmodpowu.c b/src/zmodpowu.c index 7bb4f2b..72aa96f 100644 --- a/src/zmodpowu.c +++ b/src/zmodpowu.c @@ -16,7 +16,7 @@ zmodpowu(z_t a, z_t b, unsigned long long int c, z_t d) else zsetu(a, 1); return; - } else if (check(unlikely(zzero(d)))) { + } else if (check(zzero(d))) { libzahl_failure(-ZERROR_DIV_0); } else if (unlikely(zzero(b))) { SET_SIGNUM(a, 0); diff --git a/src/zrand.c b/src/zrand.c index 079520e..020b58c 100644 --- a/src/zrand.c +++ b/src/zrand.c @@ -104,7 +104,7 @@ zrand_fd(void *out, size_t n, void *statep) while (n) { read_just = read(fd, buf + read_total, n); - if (check(unlikely(read_just < 0))) + if (check(read_just < 0)) libzahl_failure(errno); read_total += (size_t)read_just; n -= (size_t)read_just; @@ -141,7 +141,7 @@ zrand(z_t r, enum zranddev dev, enum zranddist dist, z_t n) { #define RANDOM_UNIFORM(RETRY)\ do {\ - if (check(unlikely(znegative(n))))\ + if (check(znegative(n)))\ libzahl_failure(-ZERROR_NEGATIVE);\ bits = zbits(n);\ do\ @@ -185,7 +185,7 @@ zrand(z_t r, enum zranddev dev, enum zranddist dist, z_t n) if (pathname) { fd = open(pathname, O_RDONLY); - if (check(unlikely(fd < 0))) + if (check(fd < 0)) libzahl_failure(errno); statep = &fd; } diff --git a/src/zsets.c b/src/zsets.c index 1701c6b..b5f9e04 100644 --- a/src/zsets.c +++ b/src/zsets.c @@ -17,12 +17,12 @@ zsets(z_t a, const char *str) str += neg || (*str == '+'); - if (check(unlikely(!*str))) { + if (check(!*str)) { errno = EINVAL; return -1; } for (str_end = str; *str_end; str_end++) { - if (check(unlikely(!isdigit(*str_end)))) { + if (check(!isdigit(*str_end))) { errno = EINVAL; return -1; } diff --git a/src/zsetup.c b/src/zsetup.c index df8c0c2..66d94ee 100644 --- a/src/zsetup.c +++ b/src/zsetup.c @@ -46,7 +46,7 @@ zsetup(jmp_buf env) zinit(libzahl_tmp_divmod_ds[i]); libzahl_temp_stack = malloc(256 * sizeof(*libzahl_temp_stack)); - if (check(unlikely(!libzahl_temp_stack))) + if (check(!libzahl_temp_stack)) libzahl_memfailure(); libzahl_temp_stack_head = libzahl_temp_stack; libzahl_temp_stack_end = libzahl_temp_stack + 256; |
