Revision | 96c805261fc920d329e7ef56d1cd1586161c3c3b (tree) |
---|---|
Zeit | 2018-10-28 23:47:48 |
Autor | Takashi Sawanaka <sdottaka@user...> |
Commiter | Takashi Sawanaka |
DiffTextBuffer.cpp: Impletement 'TODO: speed this up via table lookup'
@@ -84,9 +84,8 @@ static void EscapeControlChars(String &s) | ||
84 | 84 | // Is it a control character in the range 0..31 except TAB? |
85 | 85 | if (!(c & ~_T('\x1F')) && c != _T('\t')) |
86 | 86 | { |
87 | - // TODO: speed this up via table lookup | |
88 | - // Bitwise OR with 0x100 so _itot_s() will output 3 hex digits | |
89 | - _itot_s(0x100 | c, p + n - 4, 4, 16); | |
87 | + p[n - 4 + 1] = _T("0123456789ABCDEF")[(c >> 4) & 0xf]; | |
88 | + p[n - 4 + 2] = _T("0123456789ABCDEF")[c & 0xf]; | |
90 | 89 | // Replace terminating zero with leadout character |
91 | 90 | p[n - 1] = _T('\\'); |
92 | 91 | // Prepare to replace 1st hex digit with leadin character |