Commit ffc8fbe3 authored by Waqar Ahmed's avatar Waqar Ahmed Committed by Tomaz Canabrava
Browse files

Optimize Character::width for ascii/ < 256 cases

This runs much faster.

- Avoids table lookup
- Allows inlined method to be more useful
parent b504fb2c
Pipeline #108819 passed with stage
in 2 minutes and 1 second
......@@ -138,6 +138,21 @@ public:
static int width(uint ucs4)
{
// ASCII
if (ucs4 >= 0x20 && ucs4 < 0x7f)
return 1;
if (ucs4 >= 0xA0 && ucs4 <= 0xFF)
return 1;
// NULL
if (ucs4 == 0)
return 0;
// Control chars
if ((ucs4 > 0x0 && ucs4 < 0x20) || (ucs4 >= 0x7F && ucs4 < 0xA0))
return -1;
return characterWidth(ucs4);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment