Commit 7a2c851d authored by Benno Schulenberg's avatar Benno Schulenberg
Browse files

tweaks: reorder some ifs, to reduce the average number of comparisons

No related merge requests found
Showing with 11 additions and 11 deletions
+11 -11
...@@ -1508,20 +1508,20 @@ long get_unicode_kbinput(WINDOW *win, int kbinput) ...@@ -1508,20 +1508,20 @@ long get_unicode_kbinput(WINDOW *win, int kbinput)
* Ctrl-8 == Ctrl-? */ * Ctrl-8 == Ctrl-? */
int get_control_kbinput(int kbinput) int get_control_kbinput(int kbinput)
{ {
if ('@' <= kbinput && kbinput <= '_')
return kbinput - '@';
if ('`' <= kbinput && kbinput <= '~')
return kbinput - '`';
if ('3' <= kbinput && kbinput <= '7')
return kbinput - 24;
if (kbinput == '?' || kbinput == '8')
return DEL_CODE;
if (kbinput == ' ' || kbinput == '2') if (kbinput == ' ' || kbinput == '2')
return 0; return 0;
else if (kbinput == '/') if (kbinput == '/')
return 31; return 31;
else if ('3' <= kbinput && kbinput <= '7')
return kbinput - 24; return kbinput;
else if (kbinput == '8' || kbinput == '?')
return DEL_CODE;
else if ('@' <= kbinput && kbinput <= '_')
return kbinput - '@';
else if ('`' <= kbinput && kbinput <= '~')
return kbinput - '`';
else
return kbinput;
} }
/* Read in a stream of characters verbatim, and return the length of the /* Read in a stream of characters verbatim, and return the length of the
......
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