summaryrefslogtreecommitdiff
path: root/magic_buddy
diff options
context:
space:
mode:
authorMatthew Sotoudeh <matthew@masot.net>2024-05-17 15:57:30 -0700
committerMatthew Sotoudeh <matthew@masot.net>2024-05-17 15:57:30 -0700
commitd068f0b3c11348a50c18af1ee3b0d2e5f38c4faf (patch)
treedb777acca2336f8c279e9f09346f02de7ddaa0e9 /magic_buddy
parent221b05e7a86faa38036429d5fbfc8b0779eb5382 (diff)
lua benchmarks
Diffstat (limited to 'magic_buddy')
-rw-r--r--magic_buddy/magic_buddy.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/magic_buddy/magic_buddy.c b/magic_buddy/magic_buddy.c
index 15bd23f..da18d4a 100644
--- a/magic_buddy/magic_buddy.c
+++ b/magic_buddy/magic_buddy.c
@@ -15,10 +15,10 @@ struct free_block {
// https://stackoverflow.com/questions/11376288/fast-computing-of-log2-for-64-bit-integers
static size_t size2log(size_t size, int ceil) {
#if 1
+ if (!size) return 0;
size_t floor_log
= (8*sizeof(unsigned long long))
- __builtin_clzll((unsigned long long)size) - 1;
- if (!size) floor_log = 0;
return (ceil && (size > (1 << floor_log))) ? (floor_log + 1) : floor_log;
#else
size_t floor_log = 0;
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback