[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v5 10/11] misc: Add grub_log2ull macro for calculating log base 2
From: |
Glenn Washburn |
Subject: |
[PATCH v5 10/11] misc: Add grub_log2ull macro for calculating log base 2 of 64-bit integers |
Date: |
Sun, 22 Nov 2020 23:23:23 -0600 |
Signed-off-by: Glenn Washburn <development@efficientek.com>
---
include/grub/misc.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/include/grub/misc.h b/include/grub/misc.h
index b7ca6dd58..85a481f0c 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 v5 00/11] Cryptodisk fixes for v2.06 redux, (continued)
- [PATCH v5 00/11] Cryptodisk fixes for v2.06 redux, Glenn Washburn, 2020/11/23
- [PATCH v5 01/11] luks2: Add slot_key member to struct grub_luks2_keyslot/segment/digest, Glenn Washburn, 2020/11/23
- [PATCH v5 02/11] luks: Use more intuitive slot key instead of index in user messages., Glenn Washburn, 2020/11/23
- [PATCH v5 03/11] cryptodisk: Replace some literals with constants in grub_cryptodisk_endecrypt, Glenn Washburn, 2020/11/23
- [PATCH v5 04/11] luks2: grub_cryptodisk_t->total_sectors is the max number of device native sectors, Glenn Washburn, 2020/11/23
- [PATCH v5 05/11] cryptodisk: Properly handle non-512 byte sized sectors, Glenn Washburn, 2020/11/23
- [PATCH v5 06/11] luks2: Better error handling when setting up the cryptodisk, Glenn Washburn, 2020/11/23
- [PATCH v5 08/11] whitespace: convert 8 spaces to tabs., Glenn Washburn, 2020/11/23
- [PATCH v5 07/11] luks2: Error check segment.sector_size, Glenn Washburn, 2020/11/23
- [PATCH v5 09/11] mips: Enable __clzdi2(), Glenn Washburn, 2020/11/23
- [PATCH v5 10/11] misc: Add grub_log2ull macro for calculating log base 2 of 64-bit integers,
Glenn Washburn <=
- [PATCH v5 11/11] luks2: Use grub_log2ull to calculate log_sector_size and improve readability, Glenn Washburn, 2020/11/23
- [PATCH v6 00/12] Cryptodisk fixes for v2.06 redux, Glenn Washburn, 2020/11/27
- [PATCH v6 01/12] luks2: Add slot_key member to struct grub_luks2_keyslot/segment/digest, Glenn Washburn, 2020/11/27
- [PATCH v6 02/12] luks2: Use more intuitive slot key instead of index in user messages., Glenn Washburn, 2020/11/27
- [PATCH v6 03/12] luks2: Remove unused argument in grub_error, Glenn Washburn, 2020/11/27
- [PATCH v6 04/12] cryptodisk: Replace some literals with constants in grub_cryptodisk_endecrypt, Glenn Washburn, 2020/11/27
- [PATCH v6 05/12] luks2: grub_cryptodisk_t->total_sectors is the max number of device native sectors, Glenn Washburn, 2020/11/27
- [PATCH v6 06/12] cryptodisk: Properly handle non-512 byte sized sectors, Glenn Washburn, 2020/11/27
- [PATCH v6 07/12] luks2: Better error handling when setting up the cryptodisk, Glenn Washburn, 2020/11/27
- [PATCH v6 08/12] luks2: Error check segment.sector_size, Glenn Washburn, 2020/11/27