Commit e4a0b1d
committed
Auto merge of #118239 - scottmcm:alternative_layout_array, r=<try>
Use `usize::checked_mul` for `Layout::array` checks again
I found a little trick that allows us to check the `isize::MAX` limit using `usize::checked_mul`. No idea whether that's a good idea, but let's see what perf has to say...
Inspired by #118228
r? `@ghost`File tree
2 files changed
+21
-22
lines changed- library/core/src/alloc
- tests/codegen
2 files changed
+21
-22
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
432 | 432 | | |
433 | 433 | | |
434 | 434 | | |
435 | | - | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
436 | 440 | | |
437 | 441 | | |
438 | 442 | | |
439 | | - | |
| 443 | + | |
440 | 444 | | |
441 | 445 | | |
442 | 446 | | |
443 | | - | |
444 | | - | |
445 | | - | |
446 | | - | |
447 | | - | |
448 | | - | |
449 | | - | |
| 447 | + | |
450 | 448 | | |
451 | | - | |
452 | | - | |
453 | | - | |
454 | | - | |
455 | | - | |
456 | | - | |
457 | | - | |
458 | | - | |
| 449 | + | |
| 450 | + | |
459 | 451 | | |
460 | 452 | | |
461 | 453 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
19 | 24 | | |
20 | 25 | | |
21 | 26 | | |
| |||
29 | 34 | | |
30 | 35 | | |
31 | 36 | | |
| 37 | + | |
| 38 | + | |
0 commit comments