[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v9 5/6] misc: Add grub_log2ull macro for calculating log base 2 o
From: |
Glenn Washburn |
Subject: |
[PATCH v9 5/6] misc: Add grub_log2ull macro for calculating log base 2 of 64-bit integers |
Date: |
Tue, 15 Dec 2020 17:31:10 -0600 |
Signed-off-by: Glenn Washburn <development@efficientek.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
---
include/grub/misc.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/include/grub/misc.h b/include/grub/misc.h
index 780a34e90..73a514eb1 100644
--- a/include/grub/misc.h
+++ b/include/grub/misc.h
@@ -482,4 +482,7 @@ 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 */
--
2.27.0
- [PATCH v9 0/6] Cryptodisk fixes for v2.06 redux, Glenn Washburn, 2020/12/15
- [PATCH v9 1/6] luks2: Convert to crypt sectors from grub native sectors, Glenn Washburn, 2020/12/15
- [PATCH v9 2/6] luks2: Do not handle disks of size GRUB_DISK_SIZE_UNKNOWN for now, Glenn Washburn, 2020/12/15
- [PATCH v9 3/6] luks2: Better error handling when setting up the cryptodisk, Glenn Washburn, 2020/12/15
- [PATCH v9 4/6] mips: Enable __clzdi2(), Glenn Washburn, 2020/12/15
- [PATCH v9 5/6] misc: Add grub_log2ull macro for calculating log base 2 of 64-bit integers,
Glenn Washburn <=
- [PATCH v9 6/6] luks2: Use grub_log2ull to calculate log_sector_size and improve readability, Glenn Washburn, 2020/12/15