*: optimize most of isXXXXX() macros

   text    data     bss     dec     hex filename
 824164     453    6812  831429   cafc5 busybox_old
 823730     453    6812  830995   cae13 busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
diff --git a/include/libbb.h b/include/libbb.h
index ad0d59d..8058463 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -1566,8 +1566,11 @@
 #define RB_POWER_OFF   0x4321fedc
 #endif
 
-/* Make sure we call functions instead of macros.  */
+/* Make sure we call functions instead of these macros */
 #undef isalnum
+#undef ispunct
+#undef isxdigit
+/* and these we'll redefine */
 #undef isalpha
 #undef isascii
 #undef isblank
@@ -1575,25 +1578,32 @@
 #undef isgraph
 #undef islower
 #undef isprint
-#undef ispunct
 #undef isupper
-#undef isxdigit
+#undef isdigit
+#undef isspace
 
 /* This one is more efficient - we save ~500 bytes.
  * BTW, x86 likes (unsigned char) cast more than (unsigned). */
-#undef isdigit
 #define isdigit(a) ((unsigned char)((a) - '0') <= 9)
 
-/* This one is more efficient too! ~200 bytes */
+#define isascii(a) ((unsigned char)(a) <= 0x7f)
+#define isgraph(a) ((unsigned char)(a) > ' ')
+#define isprint(a) ((unsigned char)(a) >= ' ')
+#define isupper(a) ((unsigned char)((a) - 'A') <= ('Z' - 'A'))
+#define islower(a) ((unsigned char)((a) - 'a') <= ('z' - 'a'))
+#define isalpha(a) ((unsigned char)(((a) | 0x20) - 'a') <= ('z' - 'a'))
+#define isblank(a) ({ unsigned char bb__isblank = (a); bb__isblank == ' ' || bb__isblank == '\t'; })
+#define iscntrl(a) ({ unsigned char bb__iscntrl = (a); bb__iscntrl < ' ' || bb__iscntrl == 0x7f; })
+
 /* In POSIX/C locale (the only locale we care about: do we REALLY want
  * to allow Unicode whitespace in, say, .conf files? nuts!)
  * isspace is only these chars: "\t\n\v\f\r" and space.
  * "\t\n\v\f\r" happen to have ASCII codes 9,10,11,12,13.
  * Use that.
  */
-#undef isspace
 #define isspace(a) ({ unsigned char bb__isspace = (a) - 9; bb__isspace == (' ' - 9) || bb__isspace <= (13 - 9); })
 
+
 #define ARRAY_SIZE(x) ((unsigned)(sizeof(x) / sizeof((x)[0])))