Commit 62f4333a by Benjamin Kosnik Committed by Benjamin Kosnik

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
parent c387606f
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.
2000-12-19 Gabriel Dos Reis <gdr@codesourcery.com>
* include/bits/std_complex.h (complex<float>::operator-=): Fix
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -69,8 +69,17 @@ void test01()
int i10 = std::ctype_base::print;
int i11 = std::ctype_base::cntrl;
int i12 = sizeof(std::ctype_base::mask);
VERIFY ( i01 != i02 != i03 != i04 != i05 != i06 != i07 != i08 != i09 );
VERIFY ( i01 != i10 != i11);
VERIFY ( i01 != i02);
VERIFY ( i02 != i03);
VERIFY ( i03 != i04);
VERIFY ( i04 != i05);
VERIFY ( i05 != i06);
VERIFY ( i06 != i07);
VERIFY ( i07 != i08);
VERIFY ( i08 != i09);
VERIFY ( i09 != i10);
VERIFY ( i10 != i11);
VERIFY ( i11 != i01);
// bool is(mask m, char c) const;
VERIFY( gctype.is(std::ctype_base::space, c30) );
......@@ -118,14 +127,17 @@ void test01()
VERIFY( gctype.is(m01[1], cc0[1]) );
VERIFY( gctype.is(m01[2], cc0[2]) );
cc0 = strlit00;
cc0 = strlit01;
cc1 = gctype.is(cc0, cc0 + 13, m02);
VERIFY( cc1 == strlit00 + 13);
VERIFY( cc1 == strlit01 + 13);
VERIFY( m02[6] != m00 );
VERIFY( m02[7] != m00 );
VERIFY( m02[8] != m00 );
VERIFY( m02[8] != m02[6] != m02[7] );
VERIFY( m02[8] != m02[6] );
VERIFY( m02[6] != m02[7] );
VERIFY( static_cast<bool>(m02[6] & std::ctype_base::alnum) );
VERIFY( static_cast<bool>(m02[6] & std::ctype_base::upper) );
VERIFY( static_cast<bool>(m02[6] & std::ctype_base::alpha) );
VERIFY( static_cast<bool>(m02[7] & std::ctype_base::punct) );
VERIFY( static_cast<bool>(m02[8] & std::ctype_base::space) );
VERIFY( gctype.is(m02[6], cc0[6]) );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment