From 7a2c851dfc3170c89714f8a7823e9c1e164b5c54 Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@telfort.nl>
Date: Sun, 30 Dec 2018 17:50:10 +0100
Subject: [PATCH] tweaks: reorder some ifs, to reduce the average number of
 comparisons

---
 src/winio.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/winio.c b/src/winio.c
index 1cdb664a..6d48a6c1 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -1508,20 +1508,20 @@ long get_unicode_kbinput(WINDOW *win, int kbinput)
  *   Ctrl-8 == Ctrl-? */
 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')
 		return 0;
-	else if (kbinput == '/')
+	if (kbinput == '/')
 		return 31;
-	else if ('3' <= kbinput && kbinput <= '7')
-		return kbinput - 24;
-	else if (kbinput == '8' || kbinput == '?')
-		return DEL_CODE;
-	else if ('@' <= kbinput && kbinput <= '_')
-		return kbinput - '@';
-	else if ('`' <= kbinput && kbinput <= '~')
-		return kbinput - '`';
-	else
-		return kbinput;
+
+	return kbinput;
 }
 
 /* Read in a stream of characters verbatim, and return the length of the
-- 
GitLab