misc: Add grub_log2ull() macro for calculating log base 2 of 64-bit integers

Signed-off-by: Glenn Washburn <development@efficientek.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
This commit is contained in:
Glenn Washburn 2020-12-15 17:31:10 -06:00 committed by Daniel Kiper
parent 9b4e8f0c4b
commit 3ab19ba3b1

View File

@ -482,4 +482,6 @@ void EXPORT_FUNC(grub_real_boot_time) (const char *file,
#define grub_max(a, b) (((a) > (b)) ? (a) : (b))
#define grub_min(a, b) (((a) < (b)) ? (a) : (b))
#define grub_log2ull(n) (GRUB_TYPE_BITS (grub_uint64_t) - __builtin_clzll (n) - 1)
#endif /* ! GRUB_MISC_HEADER */