summaryrefslogtreecommitdiff
path: root/magic_buddy/magic_buddy.c
diff options
context:
space:
mode:
Diffstat (limited to 'magic_buddy/magic_buddy.c')
-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