Commit 0d83998
authored
Rollup merge of rust-lang#100556 - Alex-Velez:patch-1, r=scottmcm
Clamp Function for f32 and f64
I thought the clamp function could use a little improvement for readability purposes. The function now returns early in order to skip the extra bound checks.
If there was a reason for binding `self` to `x` or if this code is incorrect, please correct me :)File tree
3 files changed
+37
-14
lines changed- library/core/src/num
- src/test/assembly
3 files changed
+37
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1282 | 1282 | | |
1283 | 1283 | | |
1284 | 1284 | | |
1285 | | - | |
| 1285 | + | |
1286 | 1286 | | |
1287 | | - | |
1288 | | - | |
1289 | | - | |
| 1287 | + | |
| 1288 | + | |
1290 | 1289 | | |
1291 | | - | |
1292 | | - | |
| 1290 | + | |
| 1291 | + | |
1293 | 1292 | | |
1294 | | - | |
| 1293 | + | |
1295 | 1294 | | |
1296 | 1295 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1280 | 1280 | | |
1281 | 1281 | | |
1282 | 1282 | | |
1283 | | - | |
| 1283 | + | |
1284 | 1284 | | |
1285 | | - | |
1286 | | - | |
1287 | | - | |
| 1285 | + | |
| 1286 | + | |
1288 | 1287 | | |
1289 | | - | |
1290 | | - | |
| 1288 | + | |
| 1289 | + | |
1291 | 1290 | | |
1292 | | - | |
| 1291 | + | |
1293 | 1292 | | |
1294 | 1293 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
0 commit comments