diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2009-01-06 00:00:21 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2009-01-06 00:00:21 +0000 |
commit | 0d791659e1150154404bf311bf706063b65303e8 (patch) | |
tree | e6dcb96ed9c8ae1435572119bcefebfd9bbf8f27 /include/parserutils/input/inputstream.h | |
parent | 956b5e0ddbd0d4aefef58f9a512cae62bf46ae8e (diff) | |
download | libparserutils-0d791659e1150154404bf311bf706063b65303e8.tar.gz libparserutils-0d791659e1150154404bf311bf706063b65303e8.tar.bz2 |
Dubious optimisation I've had sitting around for ages.
svn path=/trunk/libparserutils/; revision=5963
Diffstat (limited to 'include/parserutils/input/inputstream.h')
-rw-r--r-- | include/parserutils/input/inputstream.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/include/parserutils/input/inputstream.h b/include/parserutils/input/inputstream.h index fefc0ce..dac1ab7 100644 --- a/include/parserutils/input/inputstream.h +++ b/include/parserutils/input/inputstream.h @@ -110,8 +110,10 @@ static inline uintptr_t parserutils_inputstream_peek( #define IS_ASCII(x) (((x) & 0x80) == 0) if (off < utf8_len) { - if (IS_ASCII(utf8->data[off])) { - len = 1; + if (IS_ASCII(utf8_data[off])) { + /* Early exit for ASCII case */ + (*length) = 1; + return (uintptr_t) (utf8_data + off); } else { error = parserutils_charset_utf8_char_byte_length( utf8_data + off, &len); |