]> git.eshelyaron.com Git - emacs.git/commitdiff
* keyboard.c (make_lispy_event): Avoid unnecessary tests
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 24 Sep 2014 18:25:04 +0000 (11:25 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 24 Sep 2014 18:25:04 +0000 (11:25 -0700)
of bit 28 and of whether an unsigned value is negative.
This simplifies the code a bit, and pacifies clang 3.4.

src/ChangeLog
src/keyboard.c

index 9e4492d2c90cef5ef8e7c7c5ea8b64627950539c..9ee4a3de1d0367cf3cfae1b1135f45993062679b 100644 (file)
@@ -1,3 +1,9 @@
+2014-09-24  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * keyboard.c (make_lispy_event): Avoid unnecessary tests
+       of bit 28 and of whether an unsigned value is negative.
+       This simplifies the code a bit, and pacifies clang 3.4.
+
 2014-09-24  Eli Zaretskii  <eliz@gnu.org>
 
        * systime.h (Time): Define as size_t, to be consistent with 64-bit
index 7625586650f0527390b29e65b2993ae283e45955..718614f080acb6a108270d22012432bb5d5bb91b 100644 (file)
@@ -5548,30 +5548,27 @@ make_lispy_event (struct input_event *event)
                                     ARRAYELTS (iso_lispy_function_keys));
 #endif
 
-      /* Handle system-specific or unknown keysyms.  */
-      if (event->code & (1 << 28)
-         || event->code - FUNCTION_KEY_OFFSET < 0
-         || (event->code - FUNCTION_KEY_OFFSET
-             >= ARRAYELTS (lispy_function_keys))
-         || !lispy_function_keys[event->code - FUNCTION_KEY_OFFSET])
-       {
-         /* We need to use an alist rather than a vector as the cache
-            since we can't make a vector long enough.  */
-         if (NILP (KVAR (current_kboard, system_key_syms)))
-           kset_system_key_syms (current_kboard, Fcons (Qnil, Qnil));
-         return modify_event_symbol (event->code,
-                                     event->modifiers,
-                                     Qfunction_key,
-                                     KVAR (current_kboard, Vsystem_key_alist),
-                                     0, &KVAR (current_kboard, system_key_syms),
-                                     PTRDIFF_MAX);
-       }
-
-      return modify_event_symbol (event->code - FUNCTION_KEY_OFFSET,
+      if ((FUNCTION_KEY_OFFSET <= event->code
+          && (event->code
+              < FUNCTION_KEY_OFFSET + ARRAYELTS (lispy_function_keys)))
+         && lispy_function_keys[event->code - FUNCTION_KEY_OFFSET])
+       return modify_event_symbol (event->code - FUNCTION_KEY_OFFSET,
+                                   event->modifiers,
+                                   Qfunction_key, Qnil,
+                                   lispy_function_keys, &func_key_syms,
+                                   ARRAYELTS (lispy_function_keys));
+
+      /* Handle system-specific or unknown keysyms.
+        We need to use an alist rather than a vector as the cache
+        since we can't make a vector long enough.  */
+      if (NILP (KVAR (current_kboard, system_key_syms)))
+       kset_system_key_syms (current_kboard, Fcons (Qnil, Qnil));
+      return modify_event_symbol (event->code,
                                  event->modifiers,
-                                 Qfunction_key, Qnil,
-                                 lispy_function_keys, &func_key_syms,
-                                  ARRAYELTS (lispy_function_keys));
+                                 Qfunction_key,
+                                 KVAR (current_kboard, Vsystem_key_alist),
+                                 0, &KVAR (current_kboard, system_key_syms),
+                                 PTRDIFF_MAX);
 
 #ifdef HAVE_NTGUI
     case MULTIMEDIA_KEY_EVENT: