std: mark two helper functions #[inline].
`str::utf8_char_width` and `char::from_u32` are tiny, which means it's a big performance hit to call them in a tight loop outside libstd.
This commit is contained in:
@@ -1061,6 +1061,7 @@ static UTF8_CHAR_WIDTH: [u8, ..256] = [
|
||||
];
|
||||
|
||||
/// Given a first byte, determine how many bytes are in this UTF-8 character
|
||||
#[inline]
|
||||
pub fn utf8_char_width(b: u8) -> uint {
|
||||
return UTF8_CHAR_WIDTH[b] as uint;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user