rust/library/core/tests
Simonas Kazlauskas a3c3f722b7 Fix mod_inv termination for the last iteration
On usize=u64 platforms, the 4th iteration would overflow the `mod_gate`
back to 0. Similarly for usize=u32 platforms, the 3rd iteration would
overflow much the same way.

I tested various approaches to resolving this, including approaches with
`saturating_mul` and `widening_mul` to a double usize. Turns out LLVM
likes `mul_with_overflow` the best. In fact now, that LLVM can see the
iteration count is limited, it will happily unroll the loop into a nice
linear sequence.

You will also notice that the code around the loop got simplified
somewhat. Now that LLVM is handling the loop nicely, there isn’t any
more reasons to manually unroll the first iteration out of the loop
(though looking at the code today I’m not sure all that complexity was
necessary in the first place).

Fixes #103361
2022-10-22 03:46:48 +03:00
..
fmt
hash libcore tests: avoid int2ptr casts 2022-06-27 13:30:44 -04:00
iter Rollup merge of #100220 - scottmcm:fix-by-ref-sized, r=joshtriplett 2022-08-24 18:20:08 +02:00
num more dupe word typos 2022-10-14 12:57:56 +08:00
ops
panic Fix test (location_const_file) 2022-10-08 11:48:53 +00:00
alloc.rs Re-optimize Layout::array 2022-07-13 17:07:41 -07:00
any.rs Support eager and lazy methods for providing references and values 2022-08-23 09:58:50 -04:00
array.rs Stabilize core::array::from_fn 2022-05-20 11:04:13 -03:00
ascii.rs introduce {char, u8}::is_ascii_octdigit 2022-09-27 11:55:13 +05:30
asserting.rs [RFC 2011] Library code 2022-05-22 07:18:32 -03:00
atomic.rs Make use of [wrapping_]byte_{add,sub} 2022-08-23 19:32:37 +04:00
bool.rs
cell.rs Fix Display for cell::{Ref,RefMut} 2022-05-20 11:16:30 -07:00
char.rs Debug print char 0 as '\0' rather than '\u{0}' 2022-03-27 04:49:10 -07:00
clone.rs Use Box::new() instead of box syntax in core tests 2022-05-29 01:44:11 +02:00
cmp.rs Add test for StructuralEq for std::cmp::Ordering. 2022-03-16 14:01:48 -05:00
const_ptr.rs cleanup code w/ pointers in std a little 2022-08-05 16:47:49 +04:00
convert.rs
future.rs
intrinsics.rs
lazy.rs Move/rename lazy::{OnceCell, Lazy} to cell::{OnceCell, LazyCell} 2022-06-16 19:53:59 +04:00
lib.rs Remove all uses of array_assume_init 2022-10-17 13:03:54 -07:00
macros.rs
manually_drop.rs
mem.rs Adjust transmute{,_copy} to be clearer about which of T and U is input vs output 2022-10-19 22:36:14 -07:00
nonzero.rs
ops.rs
option.rs fixup lint name 2022-10-09 13:07:21 +00:00
panic.rs Add newlines 2022-09-27 19:23:52 +00:00
pattern.rs
pin_macro.rs
pin.rs
ptr.rs Fix mod_inv termination for the last iteration 2022-10-22 03:46:48 +03:00
result.rs Remove unstable Result::into_ok_or_err 2022-08-17 17:20:42 -07:00
simd.rs Introduce core::simd trait imports in tests 2022-07-20 18:08:20 -07:00
slice.rs make const_err a hard error 2022-10-07 18:08:49 +02:00
str_lossy.rs Expose Utf8Lossy as Utf8Chunks 2022-08-20 12:49:20 -04:00
str.rs
task.rs Made from_waker, waker, from_raw const 2022-09-14 14:53:16 +02:00
time.rs Fix Duration::{try_,}from_secs_f{32,64}(-0.0) 2022-10-14 16:07:09 +01:00
tuple.rs
unicode.rs revert changes to unicode stability 2022-07-08 21:18:15 +00:00
waker.rs libcore tests: avoid int2ptr casts 2022-06-27 13:30:44 -04:00