diff options
author | Benjamin Kosnik <bkoz@fillmore.redhat.com> | 2000-12-19 19:49:00 +0000 |
---|---|---|
committer | Benjamin Kosnik <bkoz@gcc.gnu.org> | 2000-12-19 19:49:00 +0000 |
commit | 62f4333a68e86e13c02d9436a71bb7367ffcaea8 (patch) | |
tree | c26d566d555a6dbd35adf57e919628e8e7044fe4 /libstdc++-v3/config | |
parent | c387606fe86d65768afb5a0225f7b6659e8c8f9d (diff) | |
download | gcc-62f4333a68e86e13c02d9436a71bb7367ffcaea8.tar.gz |
ctype_inline.h (is): Same.
2000-12-19 Benjamin Kosnik <bkoz@fillmore.redhat.com>
* config/os/solaris/solaris2.5/bits/ctype_inline.h (is): Same.
* config/os/solaris/solaris2.6/bits/ctype_inline.h (is): Same.
* config/os/solaris/solaris2.7/bits/ctype_inline.h (is): Same.
* config/os/newlib/bits/ctype_inline.h (is): Same.
* config/os/irix/bits/ctype_inline.h (is): Same.
* config/os/bsd/netbsd/bits/ctype_inline.h (is): Same.
* config/os/bsd/freebsd/bits/ctype_inline.h (is): Same.
* config/os/aix/bits/ctype_inline.h (is): Same.
* config/os/gnu-linux/bits/ctype_inline.h (is): Revert.
* config/os/generic/bits/ctype_inline.h (is): Non-table based
implementation.
* testsuite/22_locale/ctype_char_members.cc (test01): Use binary
operator correctly.
(test01): Check 'A' for alnum, upper, alpha.
From-SVN: r38385
Diffstat (limited to 'libstdc++-v3/config')
9 files changed, 32 insertions, 73 deletions
diff --git a/libstdc++-v3/config/os/aix/bits/ctype_inline.h b/libstdc++-v3/config/os/aix/bits/ctype_inline.h index 16e011c4a9a..d9df620b010 100644 --- a/libstdc++-v3/config/os/aix/bits/ctype_inline.h +++ b/libstdc++-v3/config/os/aix/bits/ctype_inline.h @@ -43,15 +43,8 @@ ctype<char>:: is(const char* __low, const char* __high, mask* __vec) const { - const int __bitmasksize = sizeof(mask) * 8; - for (;__low < __high; ++__vec, ++__low) - { - mask __m = __OBJ_DATA(__lc_ctype)->mask[*__low++]; - int __i = 0; // Lowest bitmask. - while (__i < __bitmasksize && !(__m & static_cast<mask>(1 << __i))) - ++__i; - *__vec = static_cast<mask>(1 << __i); - } + while (__low < __high) + *__vec++ = __OBJ_DATA(__lc_ctype)->mask[*__low++]; return __high; } diff --git a/libstdc++-v3/config/os/bsd/freebsd/bits/ctype_inline.h b/libstdc++-v3/config/os/bsd/freebsd/bits/ctype_inline.h index b51867dcac2..c282c4bf158 100644 --- a/libstdc++-v3/config/os/bsd/freebsd/bits/ctype_inline.h +++ b/libstdc++-v3/config/os/bsd/freebsd/bits/ctype_inline.h @@ -48,14 +48,18 @@ ctype<char>:: is(const char* __low, const char* __high, mask* __vec) const { - const int __bitmasksize = sizeof(mask) * 8; + const int __bitmasksize = 11; // Highest bitmask in ctype_base == 10 for (;__low < __high; ++__vec, ++__low) { - mask __m = _M_table[*__low]; - int __i = 0; // Lowest bitmask value, 1 == 1 << 0 means 0 - while (__i < __bitmasksize && !(__m & static_cast<mask>(1 << __i))) - ++__i; - *__vec = static_cast<mask>(1 << __i); + mask __m = 0; + int __i = 0; // Lowest bitmask in ctype_base == 0 + for (;__i < __bitmasksize; ++__i) + { + mask __bit = static_cast<mask>(1 << __i); + if (this->is(__bit, *__low)) + __m |= __bit; + } + *__vec = __m; } return __high; } diff --git a/libstdc++-v3/config/os/bsd/netbsd/bits/ctype_inline.h b/libstdc++-v3/config/os/bsd/netbsd/bits/ctype_inline.h index 2d72d9896cf..f6dfc4d7f65 100644 --- a/libstdc++-v3/config/os/bsd/netbsd/bits/ctype_inline.h +++ b/libstdc++-v3/config/os/bsd/netbsd/bits/ctype_inline.h @@ -43,15 +43,8 @@ ctype<char>:: is(const char* __low, const char* __high, mask* __vec) const { - const int __bitmasksize = sizeof(mask) * 8; - for (;__low < __high; ++__vec, ++__low) - { - mask __m = _M_table[*__low]; - int __i = 0; // Lowest bitmask. - while (__i < __bitmasksize && !(__m & static_cast<mask>(1 << __i))) - ++__i; - *__vec = static_cast<mask>(1 << __i); - } + while (__low < __high) + *__vec++ = _M_table[*__low++]; return __high; } diff --git a/libstdc++-v3/config/os/generic/bits/ctype_inline.h b/libstdc++-v3/config/os/generic/bits/ctype_inline.h index 98c7e3d0309..a5f6e855a93 100644 --- a/libstdc++-v3/config/os/generic/bits/ctype_inline.h +++ b/libstdc++-v3/config/os/generic/bits/ctype_inline.h @@ -93,11 +93,15 @@ const int __bitmasksize = 11; // Highest bitmask in ctype_base == 10 for (;__low < __high; ++__vec, ++__low) { - mask __m = _M_table[*__low]; + mask __m = 0; int __i = 0; // Lowest bitmask in ctype_base == 0 - while (__i < __bitmasksize && !(__m & static_cast<mask>(1 << __i))) - ++__i; - *__vec = static_cast<mask>(1 << __i); + for (;__i < __bitmasksize; ++__i) + { + mask __bit = static_cast<mask>(1 << __i); + if (this->is(__bit, *__low)) + __m |= __bit; + } + *__vec = __m; } return __high; } diff --git a/libstdc++-v3/config/os/gnu-linux/bits/ctype_inline.h b/libstdc++-v3/config/os/gnu-linux/bits/ctype_inline.h index 83563a9ade7..4c248242625 100644 --- a/libstdc++-v3/config/os/gnu-linux/bits/ctype_inline.h +++ b/libstdc++-v3/config/os/gnu-linux/bits/ctype_inline.h @@ -43,15 +43,8 @@ ctype<char>:: is(const char* __low, const char* __high, mask* __vec) const { - const int __bitmasksize = sizeof(mask) * 8; - for (;__low < __high; ++__vec, ++__low) - { - mask __m = _M_table[*__low]; - int __i = 1; // Lowest bitmask on linux, 1 <= x <= 15 - while (__i < __bitmasksize && !(__m & static_cast<mask>(1 << __i))) - ++__i; - *__vec = static_cast<mask>(1 << __i); - } + while (__low < __high) + *__vec++ = _M_table[*__low++]; return __high; } diff --git a/libstdc++-v3/config/os/irix/bits/ctype_inline.h b/libstdc++-v3/config/os/irix/bits/ctype_inline.h index 1b400f24183..6a20c096cd5 100644 --- a/libstdc++-v3/config/os/irix/bits/ctype_inline.h +++ b/libstdc++-v3/config/os/irix/bits/ctype_inline.h @@ -43,15 +43,8 @@ ctype<char>:: is(const char* __low, const char* __high, mask* __vec) const { - const int __bitmasksize = sizeof(mask) * 8; - for (;__low < __high; ++__vec, ++__low) - { - mask __m = _M_table[*__low]; - int __i = 1; // Lowest bitmask on linux, 1 <= x <= 15 - while (__i < __bitmasksize && !(__m & static_cast<mask>(1 << __i))) - ++__i; - *__vec = static_cast<mask>(1 << __i); - } + while (__low < __high) + *__vec++ = (_M_table)[*__low++]; return __high; } diff --git a/libstdc++-v3/config/os/newlib/bits/ctype_inline.h b/libstdc++-v3/config/os/newlib/bits/ctype_inline.h index 61c4bc85898..cddffedaa44 100644 --- a/libstdc++-v3/config/os/newlib/bits/ctype_inline.h +++ b/libstdc++-v3/config/os/newlib/bits/ctype_inline.h @@ -43,15 +43,8 @@ ctype<char>:: is(const char* __low, const char* __high, mask* __vec) const { - const int __bitmasksize = sizeof(mask) * 8; - for (;__low < __high; ++__vec, ++__low) - { - mask __m = _M_table[*__low]; - int __i = 0; // Lowest bitmask with newlib, 1 << 0 == 01 - while (__i < __bitmasksize && !(__m & static_cast<mask>(1 << __i))) - ++__i; - *__vec = static_cast<mask>(1 << __i); - } + while (__low < __high) + *__vec++ = (_M_table + 1)[(unsigned char) (*__low++)]; return __high; } diff --git a/libstdc++-v3/config/os/solaris/solaris2.5/bits/ctype_inline.h b/libstdc++-v3/config/os/solaris/solaris2.5/bits/ctype_inline.h index f6719935af0..affa4945c60 100644 --- a/libstdc++-v3/config/os/solaris/solaris2.5/bits/ctype_inline.h +++ b/libstdc++-v3/config/os/solaris/solaris2.5/bits/ctype_inline.h @@ -43,15 +43,8 @@ ctype<char>:: is(const char* __low, const char* __high, mask* __vec) const { - const int __bitmasksize = sizeof(mask) * 8; - for (;__low < __high; ++__vec, ++__low) - { - mask __m = _M_table[*__low]; - int __i = 0; // Lowest bitmask in ctype_base::mask. - while (__i < __bitmasksize && !(__m & static_cast<mask>(1 << __i))) - ++__i; - *__vec = static_cast<mask>(1 << __i); - } + while (__low < __high) + *__vec++ = (_M_table + 1)[(unsigned char) (*__low++)]; return __high; } diff --git a/libstdc++-v3/config/os/solaris/solaris2.7/bits/ctype_inline.h b/libstdc++-v3/config/os/solaris/solaris2.7/bits/ctype_inline.h index f254e839fb8..8ec057dfb47 100644 --- a/libstdc++-v3/config/os/solaris/solaris2.7/bits/ctype_inline.h +++ b/libstdc++-v3/config/os/solaris/solaris2.7/bits/ctype_inline.h @@ -43,15 +43,8 @@ ctype<char>:: is(const char* __low, const char* __high, mask* __vec) const { - const int __bitmasksize = sizeof(mask) * 8; - for (;__low < __high; ++__vec, ++__low) - { - mask __m = _M_table[*__low]; - int __i = 0; // Lowest bitmask value from ctype_base. - while (__i < __bitmasksize && !(__m & static_cast<mask>(1 << __i))) - ++__i; - *__vec = static_cast<mask>(1 << __i); - } + while (__low < __high) + *__vec++ = _M_table[*__low++]; return __high; } |