From: Alan Cox Date: Sat, 2 Jun 2018 21:58:19 +0000 (+0100) Subject: vt: guide the compiler into optimizing the fast path X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=62a570e3ea5a4a560825bcdb8b1d1a0ac1072961;p=FUZIX.git vt: guide the compiler into optimizing the fast path --- diff --git a/Kernel/vt.c b/Kernel/vt.c index 68d76281..8a2c9351 100644 --- a/Kernel/vt.c +++ b/Kernel/vt.c @@ -104,35 +104,38 @@ static void cursor_fix(void) static void charout(unsigned char c) { - if (c == 7) { - do_beep(); - return; - } - if (c == 8) { - cursorx--; - goto fix; - } - if (c == 9) { - do { - charout(' '); - } while (cursorx&7); - goto fix; - } - if (c == 10) { - cursory++; - goto fix; - } - if (c == 13) { - cursorx = 0; - return; - } - if (c == 0x1b) { - vtmode = 1; - return; + /* Fast path printable symbols */ + if (c <= 0x1b) { + if (c == 7) { + do_beep(); + return; + } + if (c == 8) { + cursorx--; + goto fix; + } + if (c == 9) { + do { + charout(' '); + } while (cursorx&7); + goto fix; + } + if (c == 10) { + cursory++; + goto fix; + } + if (c == 13) { + cursorx = 0; + return; + } + if (c == 0x1b) { + vtmode = 1; + return; + } } plot_char(cursory, cursorx, c); cursorx++; - fix: +fix: cursor_fix(); }