From c30732c9c18071e783a4cdec5eb8d4ae350c8708 Mon Sep 17 00:00:00 2001 From: Anirudh Rayabharam Date: Sat, 25 Apr 2026 02:38:41 +0000 Subject: [PATCH] arch: use bit-shift expressions for cache size units Replace 1024, 1024u32.pow(2), and 1024u32.pow(3) with 1u32 << 10, 1u32 << 20, and 1u32 << 30 in get_cache_size. The shift form makes the binary (KiB/MiB/GiB) nature of the conversion immediately obvious and is easier to read at a glance. Signed-off-by: Anirudh Rayabharam --- arch/src/aarch64/cache.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/src/aarch64/cache.rs b/arch/src/aarch64/cache.rs index fe05f6dae..20247821d 100644 --- a/arch/src/aarch64/cache.rs +++ b/arch/src/aarch64/cache.rs @@ -42,9 +42,9 @@ pub fn get_cache_size(cache_level: CacheLevel) -> u32 { src_digits * match src_unit { - "K" => 1024, - "M" => 1024u32.pow(2), - "G" => 1024u32.pow(3), + "K" => 1u32 << 10, + "M" => 1u32 << 20, + "G" => 1u32 << 30, _ => 1, } } else {