rust/library/core/tests
Manish Goregaokar 6b09d60f82
Rollup merge of #103378 - nagisa:fix-infinite-offset, r=scottmcm
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-11-18 17:48:16 -05:00
..
fmt Add tests for rounding of ties during float formatting 2022-10-20 22:09:24 +02:00
hash Test const Hash, fix nits 2022-11-08 17:39:40 +01:00
iter simplification: do not process the ArrayChunks remainder in fold() 2022-11-07 21:44:25 +01:00
num Auto merge of #102935 - ajtribick:display-float-0.5-fixed-0, r=scottmcm 2022-11-16 07:20:30 +00:00
ops
panic Fix test (location_const_file) 2022-10-08 11:48:53 +00:00
alloc.rs
any.rs Format dyn Trait better in type_name intrinsic 2022-11-01 20:41:47 +00:00
array.rs
ascii.rs
asserting.rs
atomic.rs
bool.rs
cell.rs
char.rs
clone.rs
cmp.rs
const_ptr.rs
convert.rs
future.rs
intrinsics.rs
lazy.rs
lib.rs Rollup merge of #104060 - ink-feather-org:const_hash, r=fee1-dead 2022-11-10 10:47:38 -05:00
macros.rs
manually_drop.rs
mem.rs interpret: fix align_of_val on packed types 2022-10-29 15:58:32 +02:00
nonzero.rs
ops.rs
option.rs cfg-step code 2022-11-06 17:21:21 -05: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
simd.rs
slice.rs make const_err a hard error 2022-10-07 18:08:49 +02:00
str_lossy.rs
str.rs
task.rs
time.rs Fix Duration::{try_,}from_secs_f{32,64}(-0.0) 2022-10-14 16:07:09 +01:00
tuple.rs
unicode.rs
waker.rs