Commit 1cb7f91f by Benjamin Kosnik Committed by Benjamin Kosnik

bitset_members.cc: New test.


2002-04-09  Benjamin Kosnik  <bkoz@redhat.com>

	libstdc++/6124
	* testsuite/23_containers/bitset_members.cc: New test.
	* include/std/std_bitset.h (_Bit_count::_S_bit_count): Move..
	(_S_bit_count): Here.
	(_First_one::_S_first_one): Move...
	(_S_first_one): Here.
	Format.
	* src/bitset.cc: Adjust.
	* config/linker-map.gnu: Export.

From-SVN: r52066
parent e70ed0d9
2002-04-09 Benjamin Kosnik <bkoz@redhat.com>
libstdc++/6124
* testsuite/23_containers/bitset_members.cc: New test.
* include/std/std_bitset.h (_Bit_count::_S_bit_count): Move..
(_S_bit_count): Here.
(_First_one::_S_first_one): Move...
(_S_first_one): Here.
Format.
* src/bitset.cc: Adjust.
* config/linker-map.gnu: Export.
2002-04-08 Benjamin Kosnik <bkoz@redhat.com> 2002-04-08 Benjamin Kosnik <bkoz@redhat.com>
libstdc++/5180 libstdc++/5180
......
...@@ -34,7 +34,9 @@ GLIBCPP_3.1 { ...@@ -34,7 +34,9 @@ GLIBCPP_3.1 {
std::__basic_file*; std::__basic_file*;
std::__num_base*; std::__num_base*;
std::__timepunct*; std::__timepunct*;
std::__numeric_limits_base* std::__numeric_limits_base*;
std::_S_bit_count;
std::_S_first_one
}; };
# Names not in an 'extern' block are mangled names. # Names not in an 'extern' block are mangled names.
......
// Bitset definitions -*- C++ -*- // Bitset definitions -*- C++ -*-
// Copyright (C) 2001 Free Software Foundation // Copyright (C) 2001, 2002 Free Software Foundation
// //
// This file is part of GNU CC. // This file is part of GNU CC.
// //
...@@ -59,7 +59,7 @@ std::_Base_bitset<1>::_M_do_find_first(std::size_t __not_found) const ...@@ -59,7 +59,7 @@ std::_Base_bitset<1>::_M_do_find_first(std::size_t __not_found) const
unsigned char __this_byte unsigned char __this_byte
= static_cast<unsigned char>(__thisword & (~(unsigned char)0)); = static_cast<unsigned char>(__thisword & (~(unsigned char)0));
if ( __this_byte ) if ( __this_byte )
return __j*CHAR_BIT + _First_one<true>::_S_first_one[__this_byte]; return __j * CHAR_BIT + _S_first_one[__this_byte];
__thisword >>= CHAR_BIT; __thisword >>= CHAR_BIT;
} }
...@@ -93,7 +93,7 @@ std::_Base_bitset<1>::_M_do_find_next(std::size_t __prev, ...@@ -93,7 +93,7 @@ std::_Base_bitset<1>::_M_do_find_next(std::size_t __prev,
unsigned char __this_byte unsigned char __this_byte
= static_cast<unsigned char>(__thisword & (~(unsigned char)0)); = static_cast<unsigned char>(__thisword & (~(unsigned char)0));
if ( __this_byte ) if ( __this_byte )
return __j*CHAR_BIT + _First_one<true>::_S_first_one[__this_byte]; return __j * CHAR_BIT + _S_first_one[__this_byte];
__thisword >>= CHAR_BIT; __thisword >>= CHAR_BIT;
} }
...@@ -103,11 +103,10 @@ std::_Base_bitset<1>::_M_do_find_next(std::size_t __prev, ...@@ -103,11 +103,10 @@ std::_Base_bitset<1>::_M_do_find_next(std::size_t __prev,
return __not_found; return __not_found;
} // end _M_do_find_next } // end _M_do_find_next
// ------------------------------------------------------------
// Lookup tables for find and count operations.
template<bool __dummy> // Lookup tables for find and count operations.
unsigned char std::_Bit_count<__dummy>::_S_bit_count[] = { unsigned char std::_S_bit_count[256] =
{
0, /* 0 */ 1, /* 1 */ 1, /* 2 */ 2, /* 3 */ 1, /* 4 */ 0, /* 0 */ 1, /* 1 */ 1, /* 2 */ 2, /* 3 */ 1, /* 4 */
2, /* 5 */ 2, /* 6 */ 3, /* 7 */ 1, /* 8 */ 2, /* 9 */ 2, /* 5 */ 2, /* 6 */ 3, /* 7 */ 1, /* 8 */ 2, /* 9 */
2, /* 10 */ 3, /* 11 */ 2, /* 12 */ 3, /* 13 */ 3, /* 14 */ 2, /* 10 */ 3, /* 11 */ 2, /* 12 */ 3, /* 13 */ 3, /* 14 */
...@@ -160,10 +159,10 @@ unsigned char std::_Bit_count<__dummy>::_S_bit_count[] = { ...@@ -160,10 +159,10 @@ unsigned char std::_Bit_count<__dummy>::_S_bit_count[] = {
6, /* 245 */ 6, /* 246 */ 7, /* 247 */ 5, /* 248 */ 6, /* 249 */ 6, /* 245 */ 6, /* 246 */ 7, /* 247 */ 5, /* 248 */ 6, /* 249 */
6, /* 250 */ 7, /* 251 */ 6, /* 252 */ 7, /* 253 */ 7, /* 254 */ 6, /* 250 */ 7, /* 251 */ 6, /* 252 */ 7, /* 253 */ 7, /* 254 */
8 /* 255 */ 8 /* 255 */
}; // end _Bit_count }; // end _S_bit_count
template<bool __dummy> unsigned char std::_S_first_one[256] =
unsigned char std::_First_one<__dummy>::_S_first_one[] = { {
0, /* 0 */ 0, /* 1 */ 1, /* 2 */ 0, /* 3 */ 2, /* 4 */ 0, /* 0 */ 0, /* 1 */ 1, /* 2 */ 0, /* 3 */ 2, /* 4 */
0, /* 5 */ 1, /* 6 */ 0, /* 7 */ 3, /* 8 */ 0, /* 9 */ 0, /* 5 */ 1, /* 6 */ 0, /* 7 */ 3, /* 8 */ 0, /* 9 */
1, /* 10 */ 0, /* 11 */ 2, /* 12 */ 0, /* 13 */ 1, /* 14 */ 1, /* 10 */ 0, /* 11 */ 2, /* 12 */ 0, /* 13 */ 1, /* 14 */
...@@ -216,12 +215,5 @@ unsigned char std::_First_one<__dummy>::_S_first_one[] = { ...@@ -216,12 +215,5 @@ unsigned char std::_First_one<__dummy>::_S_first_one[] = {
0, /* 245 */ 1, /* 246 */ 0, /* 247 */ 3, /* 248 */ 0, /* 249 */ 0, /* 245 */ 1, /* 246 */ 0, /* 247 */ 3, /* 248 */ 0, /* 249 */
1, /* 250 */ 0, /* 251 */ 2, /* 252 */ 0, /* 253 */ 1, /* 254 */ 1, /* 250 */ 0, /* 251 */ 2, /* 252 */ 0, /* 253 */ 1, /* 254 */
0, /* 255 */ 0, /* 255 */
}; // end _First_one }; // end _S_first_one
// Explicitly instantiate them.
template unsigned char std::_Bit_count<false>::_S_bit_count[];
template unsigned char std::_Bit_count<true>::_S_bit_count[];
template unsigned char std::_First_one<false>::_S_first_one[];
template unsigned char std::_First_one<true>::_S_first_one[];
...@@ -45,9 +45,16 @@ test01(void) ...@@ -45,9 +45,16 @@ test01(void)
VERIFY( test ); VERIFY( test );
} }
// libstdc++/6124
void test02()
{
std::bitset<1> bs;
bs.count();
}
int main() int main()
{ {
test01(); test01();
test02();
return 0; return 0;
} }
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