From ad80da672915a89163838f9adbfe5b6e4c1e616e Mon Sep 17 00:00:00 2001 From: Urgau Date: Sun, 27 Oct 2024 20:34:13 +0100 Subject: [PATCH] Use Hacker's Delight impl in `i64::midpoint` instead of wide `i128` impl As LLVM seems to be outperformed by the complexity of signed 128-bits number compared to our Hacker's Delight implementation.[^1] It doesn't seems like it's an improvement for the other sizes[^2], so we let them with the wide implementation. [^1]: https://rust.godbolt.org/z/ravE75EYj [^2]: https://rust.godbolt.org/z/fzr171zKh --- library/core/src/num/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/core/src/num/mod.rs b/library/core/src/num/mod.rs index 9a5e211dd60..6a0b40ff517 100644 --- a/library/core/src/num/mod.rs +++ b/library/core/src/num/mod.rs @@ -429,7 +429,7 @@ impl i64 { from_xe_bytes_doc = "", bound_condition = "", } - midpoint_impl! { i64, i128, signed } + midpoint_impl! { i64, signed } } impl i128 { @@ -530,7 +530,7 @@ impl isize { from_xe_bytes_doc = usize_isize_from_xe_bytes_doc!(), bound_condition = " on 64-bit targets", } - midpoint_impl! { isize, i128, signed } + midpoint_impl! { isize, signed } } /// If the 6th bit is set ascii is lower case.