aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDJ Delorie <dj@redhat.com>2000-12-17 03:09:01 +0000
committerDJ Delorie <dj@redhat.com>2000-12-17 03:09:01 +0000
commit328cd6e949296bae4c7e06365c2279dce2deec28 (patch)
treec34d91757801fd96c948d7bfb7ae90eaacb67069 /include/safe-ctype.h
parent* safe-ctype.c: #include "ansidecl.h". (diff)
downloadbinutils-gdb-328cd6e949296bae4c7e06365c2279dce2deec28.tar.gz
binutils-gdb-328cd6e949296bae4c7e06365c2279dce2deec28.tar.bz2
binutils-gdb-328cd6e949296bae4c7e06365c2279dce2deec28.zip
* safe-ctype.h: Make code work on all targets and not just on
targets where a char is 8 bits.
Diffstat (limited to 'include/safe-ctype.h')
-rw-r--r--include/safe-ctype.h11
1 files changed, 3 insertions, 8 deletions
diff --git a/include/safe-ctype.h b/include/safe-ctype.h
index 977653c75a2..d5fc649051a 100644
--- a/include/safe-ctype.h
+++ b/include/safe-ctype.h
@@ -66,15 +66,10 @@ enum {
_sch_iscppsp = _sch_isvsp|_sch_isnvsp /* isspace + \0 */
};
-/* This code fundamentally assumes that a byte is 8 bits. Test this
- at compile time. */
-
-extern int a_byte_isnt_eight_bits[(unsigned char)256 == 0 ? 1 : -1];
-
/* Character classification. */
extern const unsigned short _sch_istable[256];
-#define _sch_test(c, bit) (_sch_istable[(int)(unsigned char)(c)] & (bit))
+#define _sch_test(c, bit) (_sch_istable[(c) & 0xff] & (bit))
#define ISALPHA(c) _sch_test(c, _sch_isalpha)
#define ISALNUM(c) _sch_test(c, _sch_isalnum)
@@ -98,8 +93,8 @@ extern const unsigned short _sch_istable[256];
/* Character transformation. */
extern const unsigned char _sch_toupper[256];
extern const unsigned char _sch_tolower[256];
-#define TOUPPER(c) _sch_toupper[(int)(unsigned char)(c)]
-#define TOLOWER(c) _sch_tolower[(int)(unsigned char)(c)]
+#define TOUPPER(c) _sch_toupper[(c) & 0xff]
+#define TOLOWER(c) _sch_tolower[(c) & 0xff]
#endif /* no ctype.h */
#endif /* SAFE_CTYPE_H */