From 23691c5772a044baa3e9708747364ccba0c35dd9 Mon Sep 17 00:00:00 2001 From: Laurence Tratt Date: Wed, 22 Jan 2025 08:47:25 +0000 Subject: [PATCH] Use stdlib function rather than rolling our own. --- ykrt/src/compile/jitc_yk/aot_ir.rs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/ykrt/src/compile/jitc_yk/aot_ir.rs b/ykrt/src/compile/jitc_yk/aot_ir.rs index b5858191c..60a12535b 100644 --- a/ykrt/src/compile/jitc_yk/aot_ir.rs +++ b/ykrt/src/compile/jitc_yk/aot_ir.rs @@ -1613,13 +1613,7 @@ impl IntegerTy { /// Padding for alignment is not included. #[cfg(test)] pub(crate) fn byte_size(&self) -> usize { - let bits = self.bitw(); - let mut ret = bits / 8; - // If it wasn't an exactly byte-sized thing, round up to the next byte. - if bits % 8 != 0 { - ret += 1; - } - usize::try_from(ret).unwrap() + usize::try_from(self.bitw().div_ceil(8)).unwrap() } /// Format a constant integer value that is of the type described by `self`.