summaryrefslogtreecommitdiff
path: root/wctype
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-12-08 19:53:27 +0000
committerUlrich Drepper <drepper@redhat.com>1999-12-08 19:53:27 +0000
commit49f2be5b0eea30507a77e9467d0ef2c697953bca (patch)
treef288b420d8564f4f24214b35c2703fbfc7e29fb8 /wctype
parent85cb60ffd7585e71a3d53451d0b7f0fba4e4122f (diff)
Update.
* ctype/Versions: Add __ctype32_tolower and __ctype32_toupper. * ctype/ctype-info.c: Define __ctype32_tolower and __ctype32_toupper. * locale/C-ctype.c: Add _nl_C_LC_CTYPE_toupper32 and _nl_C_LC_CTYPE_tolower32 tables. Don't compile it names of 14652 classes and maps. * locale/langinfo.h: Define _NL_CTYPE_TOUPPER32 and _NL_CTYPE_TOLOWER32. * locale/lc-ctype.c (_nl_postload_ctype): Initialize __ctype32_toupper and __ctype32_tolower. * locale/programs/ld-ctype.c (struct locale_ctype_t): Add map32. (ctype_output): Write out map32 values. (allocate_arrays): Compute mapping tables correctly. * wctype/wcfuncs.c (towlower): Use __ctype32_tolower. (towupper): Use __ctype32_toupper. * wctype/wctype.h: Optimize towupper and towlower for values < 256.
Diffstat (limited to 'wctype')
-rw-r--r--wctype/wcfuncs.c6
-rw-r--r--wctype/wctype.h16
2 files changed, 20 insertions, 2 deletions
diff --git a/wctype/wcfuncs.c b/wctype/wcfuncs.c
index 30836edb9b..2f60c4a650 100644
--- a/wctype/wcfuncs.c
+++ b/wctype/wcfuncs.c
@@ -25,6 +25,8 @@
/* If the program is compiled without optimization the following declaration
is not visible in the header. */
extern unsigned int *__ctype32_b;
+extern const uint32_t *__ctype32_toupper;
+extern const uint32_t *__ctype32_tolower;
/* Provide real-function versions of all the wctype macros. */
@@ -76,7 +78,7 @@ wint_t
/* Character is not known. Default action is to simply return it. */
return wc;
- return (wint_t) __ctype_tolower[idx];
+ return (wint_t) __ctype32_tolower[idx];
}
wint_t
@@ -90,5 +92,5 @@ wint_t
/* Character is not known. Default action is to simply return it. */
return wc;
- return (wint_t) __ctype_toupper[idx];
+ return (wint_t) __ctype32_toupper[idx];
}
diff --git a/wctype/wctype.h b/wctype/wctype.h
index 378095bcb4..2a4caddd90 100644
--- a/wctype/wctype.h
+++ b/wctype/wctype.h
@@ -238,6 +238,22 @@ extern wint_t towupper (wint_t __wc) __THROW;
/* Map the wide character WC using the mapping described by DESC. */
extern wint_t __towctrans (wint_t __wc, wctrans_t __desc) __THROW;
+#if __GNUC__ >= 2 && defined __OPTIMIZE__
+/* The tables are always organized in a way which allows direct access
+ for single byte characters. */
+extern const wint_t *__ctype32_tolower;
+extern const wint_t *__ctype32_toupper;
+
+# define towlower(wc) \
+ (__builtin_constant_p (wc) && (wc) >= L'\0' && (wc) <= L'\xff' \
+ ? (wint_t) __ctype32_tolower[wc] : towlower (wc))
+
+# define towupper(wc) \
+ (__builtin_constant_p (wc) && (wc) >= L'\0' && (wc) <= L'\xff' \
+ ? (wint_t) __ctype32_toupper[wc] : towupper (wc))
+
+#endif /* gcc && optimizing */
+
__END_DECLS
#endif /* need iswxxx. */