Minor optimization to rnibble()
authorPanu Matilainen <pmatilai@redhat.com>
Mon, 3 Sep 2012 12:44:53 +0000 (15:44 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Mon, 3 Sep 2012 12:44:53 +0000 (15:44 +0300)
- Check for lowercase letters before uppercase. A very minor difference
  as such, but our file digests use lowercase hex and this gets
  called a lot from rpmfiNew().

rpmio/rpmstring.h

index a1d90d8..16ce5ba 100644 (file)
@@ -97,10 +97,10 @@ static inline unsigned char rnibble(char c)
 {
     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;
+    if (c >= 'A' && c <= 'F')
+       return (c - 'A') + 10;
     return 0;
 }