Commit a160258
authored
Rollup merge of rust-lang#65092 - tspiteri:const-is-pow2, r=oli-obk
make is_power_of_two a const function
This makes `is_power_of_two` a const function by using `&` instead of short-circuiting `&&`; Rust supports bitwise `&` for `bool` and short-circuiting is not required in the existing expression.
I don't think this needs a const-hack label as I don't find the changed code less readable, if anything I prefer that it is clearer that short circuiting is not used.
@oli-obk2 files changed
+13
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3757 | 3757 | | |
3758 | 3758 | | |
3759 | 3759 | | |
3760 | | - | |
3761 | | - | |
| 3760 | + | |
| 3761 | + | |
3762 | 3762 | | |
3763 | 3763 | | |
3764 | 3764 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
0 commit comments