Skip to content

Commit 2a2d056

Browse files
committed
Simplify compar_int() and compar_special_int()
1 parent a5a4c91 commit 2a2d056

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/mfoc.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1198,15 +1198,15 @@ uint32_t median(denonce d)
11981198

11991199
int compar_int(const void *a, const void *b)
12001200
{
1201-
if (*(uint64_t *)b == *(uint64_t *)a) return 0;
1202-
if (*(uint64_t *)b < * (uint64_t *)a) return 1;
1203-
return -1;
1201+
uint64_t m = *(uint64_t *)a, n = *(uint64_t *)b;
1202+
return (m > n) - (m < n);
12041203
}
12051204

12061205
// Compare countKeys structure
12071206
int compar_special_int(const void *a, const void *b)
12081207
{
1209-
return (((countKeys *)b)->count - ((countKeys *)a)->count);
1208+
int m = ((countKeys *)a)->count, n = ((countKeys *)b)->count;
1209+
return (m > n) - (m < n);
12101210
}
12111211

12121212
countKeys *uniqsort(uint64_t *possibleKeys, uint32_t size)

0 commit comments

Comments
 (0)