about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSquirrel <gilescope@gmail.com>2021-05-18 18:22:04 +0100
committergilescope <gilescope@gmail.com>2022-03-26 14:25:32 +0000
commit48b7cc49a373336d8e7ac8b1c9775abc5ea1eb6d (patch)
treecc56ec709b0ffa6bc2ee6cdb4ccf6503c661632a
parent13d85ea8809910a685c52acf32f4d37632905eda (diff)
downloadrust-48b7cc49a373336d8e7ac8b1c9775abc5ea1eb6d.tar.gz
rust-48b7cc49a373336d8e7ac8b1c9775abc5ea1eb6d.zip
Update library/core/src/num/mod.rs
Co-authored-by: LingMan <LingMan@users.noreply.github.com>
-rw-r--r--library/core/src/num/mod.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/library/core/src/num/mod.rs b/library/core/src/num/mod.rs
index 19419334839..a833f4025c2 100644
--- a/library/core/src/num/mod.rs
+++ b/library/core/src/num/mod.rs
@@ -1094,8 +1094,8 @@ fn from_str_radix<T: FromStrRadixHelper>(src: &str, radix: u32) -> Result<T, Par
 
         for &c in digits {
             // When `radix` is passed in as a literal, rather than doing a slow `imul`
-            // then the compiler can use a shift if `radix` is a power of 2.
-            // (*10 can also be turned into *8 + *2).
+            // the compiler can use shifts if `radix` can be expressed as a
+            // sum of powers of 2 (x*10 can be written as x*8 + x*2).
             // When the compiler can't use these optimisations,
             // there is a latency of several cycles so doing the
             // multiply before we need to use the result helps.