diff options
| author | Folkert de Vries <folkert@folkertdev.nl> | 2025-07-05 08:36:27 +0200 |
|---|---|---|
| committer | Folkert de Vries <folkert@folkertdev.nl> | 2025-07-05 10:55:42 +0200 |
| commit | ed3711ea29398b09483e4e2a3930567e9ba81d93 (patch) | |
| tree | 58de9f15513d65c6fc1bf3cd61132ae046706e37 /compiler/rustc_abi | |
| parent | 226b0fbe11812c71c8002b10a40063571cf52b3f (diff) | |
| download | rust-ed3711ea29398b09483e4e2a3930567e9ba81d93.tar.gz rust-ed3711ea29398b09483e4e2a3930567e9ba81d93.zip | |
use `div_ceil` instead of manual logic
Diffstat (limited to 'compiler/rustc_abi')
| -rw-r--r-- | compiler/rustc_abi/src/lib.rs | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/compiler/rustc_abi/src/lib.rs b/compiler/rustc_abi/src/lib.rs index 0df8921c9b7..a438545c76f 100644 --- a/compiler/rustc_abi/src/lib.rs +++ b/compiler/rustc_abi/src/lib.rs @@ -527,8 +527,7 @@ impl Size { /// not a multiple of 8. pub fn from_bits(bits: impl TryInto<u64>) -> Size { let bits = bits.try_into().ok().unwrap(); - // Avoid potential overflow from `bits + 7`. - Size { raw: bits / 8 + ((bits % 8) + 7) / 8 } + Size { raw: bits.div_ceil(8) } } #[inline] |
