Skip to content

Commit

Permalink
sha_SSSE3.d: small optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterBright committed Oct 19, 2015
1 parent 60e6956 commit 7fe9cc8
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions std/internal/digest/sha_SSSE3.d
Expand Up @@ -142,11 +142,14 @@ version(USE_SSSE3)
/** Simple version to produce numbers < 100 as string. */
private nothrow pure string to_string(uint i)
{
if (i < 10)
return "0123456789"[i .. i + 1];

assert(i < 100);
string s;
if (i >= 10)
s ~= cast(char)('0' + (i / 10) % 10);
return s ~ cast(char)('0' + i % 10);
char[2] s;
s[0] = cast(char)(i / 10 + '0');
s[1] = cast(char)(i % 10 + '0');
return s.idup;
}

/** Returns the reference to constant used in round i. */
Expand Down

0 comments on commit 7fe9cc8

Please sign in to comment.