[patch] Use bit scanning and counting builtins for std::bitset

Falk Hueffner falk.hueffner@student.uni-tuebingen.de
Sun Feb 2 02:34:00 GMT 2003


Hi,

this patch utilizes gcc's builtin functions for bit counting and
scanning.  With it, I can achieve a speedup of 32% for a toy program
of mine (by using the Alpha "ctpop" instruction).

I didn't rebuild Makefile.in because I don't have a proper version,
and I didn't want the patch to get too big...

2003-02-02  Falk Hueffner  <falk.hueffner@student.uni-tuebingen.de>

	* include/std/std_bitset.h (_Base_bitset::_M_do_count): Use
	__builtin_popcountl.
	(_Base_bitset<1>::_M_do_count): Likewise.
	(_Base_bitset::_M_do_find_first): Use __builtin_ctzl.
	(_Base_bitset::_M_do_find_next): Likewise.
	(_Base_bitset<1>::_M_do_find_first): Likewise
	(_Base_bitset<1>::_M_do_find_next): Likewise.
	* src/bitset.cc: Delete.
	* src/Makefile.am (sources): Remove bitset.cc.

-- 
	Falk
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bitset-builtins.patch
Type: text/x-patch
Size: 16149 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20030202/2dceff5f/attachment.bin>


More information about the Libstdc++ mailing list