aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorHerman A.J. ten Brugge <Haj.Ten.Brugge@net.HCC.nl>2000-12-16 20:12:06 +0100
committerRichard Henderson <rth@gcc.gnu.org>2000-12-16 11:12:06 -0800
commitd092a9253335e1ffe2ca762e9f038362cced31c4 (patch)
treee9da1c46e1b49a7f759c3b08d34889b5cebc65e7 /include
parent68c7dea8eda115ed3056df1f127e0fcd7f43a443 (diff)
downloadgcc-d092a9253335e1ffe2ca762e9f038362cced31c4.zip
gcc-d092a9253335e1ffe2ca762e9f038362cced31c4.tar.gz
gcc-d092a9253335e1ffe2ca762e9f038362cced31c4.tar.bz2
safe-ctype.h: Make code work on all targets and not just on targets where a char is 8 bits.
* safe-ctype.h: Make code work on all targets and not just on targets where a char is 8 bits. From-SVN: r38312
Diffstat (limited to 'include')
-rw-r--r--include/ChangeLog5
-rw-r--r--include/safe-ctype.h11
2 files changed, 8 insertions, 8 deletions
diff --git a/include/ChangeLog b/include/ChangeLog
index 69c04ad..5ce8f1e 100644
--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -1,3 +1,8 @@
+2000-12-16 Herman A.J. ten Brugge <Haj.Ten.Brugge@net.HCC.nl>
+
+ * safe-ctype.h: Make code work on all targets and not just on
+ targets where a char is 8 bits.
+
2000-12-07 Zack Weinberg <zack@wolery.stanford.edu>
* safe-ctype.h: New file.
diff --git a/include/safe-ctype.h b/include/safe-ctype.h
index 977653c..d5fc649 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 */