]> git.lizzy.rs Git - rust.git/commitdiff
Explain the order of the enumeration items
authorAndrea Canciani <ranma42@gmail.com>
Thu, 26 May 2016 08:04:05 +0000 (10:04 +0200)
committerAndrea Canciani <ranma42@gmail.com>
Thu, 26 May 2016 08:04:05 +0000 (10:04 +0200)
Simply a micro-optimization to reduce code size and to open up
inlining opportunities.

src/libcore/char.rs

index 38337c7493eefba1ed011dbc609559e1f386e94d..d80b456181ae475d8e53651b30b2aefab89a38a5 100644 (file)
@@ -411,6 +411,9 @@ pub struct EscapeUnicode {
     hex_digit_idx: usize,
 }
 
+// The enum values are ordered so that their representation is the
+// same as the remaining length (besides the hexadecimal digits). This
+// likely makes `len()` a single load from memory) and inline-worth.
 #[derive(Clone, Debug)]
 enum EscapeUnicodeState {
     Done,