Skip to content

Commit

Permalink
Explain the order of the enumeration items
Browse files Browse the repository at this point in the history
Simply a micro-optimization to reduce code size and to open up
inlining opportunities.
  • Loading branch information
ranma42 committed May 26, 2016
1 parent da03950 commit 41950c6
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/libcore/char.rs
Expand Up @@ -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,
Expand Down

0 comments on commit 41950c6

Please sign in to comment.