qemacs-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemacs-commit] qemacs util.c


From: Charlie Gordon
Subject: [Qemacs-commit] qemacs util.c
Date: Sat, 25 Mar 2017 14:07:18 -0400 (EDT)

CVSROOT:        /sources/qemacs
Module name:    qemacs
Changes by:     Charlie Gordon <chqrlie>        17/03/25 14:07:18

Modified files:
        .              : util.c 

Log message:
        simplified to_hex()

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemacs/util.c?cvsroot=qemacs&r1=1.76&r2=1.77

Patches:
Index: util.c
===================================================================
RCS file: /sources/qemacs/qemacs/util.c,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -b -r1.76 -r1.77
--- util.c      1 Jan 2017 15:40:46 -0000       1.76
+++ util.c      25 Mar 2017 18:07:18 -0000      1.77
@@ -1133,15 +1133,15 @@
     return out->len - start;
 }
 
-int to_hex(int key)
+int to_hex(int c)
 {
     /* Only ASCII supported */
-    if (qe_isdigit(key))
-        return key - '0';
-    else
-    if (qe_inrange(key | ('a' - 'A'), 'a', 'f'))
-        return (key & 7) + 9;
-    else
+    if (c >= '0' && c <= '9')
+        return c - '0';
+    if (c >= 'a' && c <= 'f')
+        return c - 'a' + 10;
+    if (c >= 'A' && c <= 'F')
+        return c - 'A' + 10;
         return -1;
 }
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]