]> git.ipfire.org Git - thirdparty/gcc.git/commit - libstdc++-v3/include/std/bitset
libstdc++: Optimize std::bitset<N>::to_string
authorJonathan Wakely <jwakely@redhat.com>
Thu, 22 Sep 2022 17:36:04 +0000 (18:36 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Fri, 23 Sep 2022 11:53:51 +0000 (12:53 +0100)
commitffb03fa12850df3a4f53435d5f20ff122c83732a
treebb96526f6ad40cc63d4888c4ac751e47c5f12291
parent14d4b4fb12041dde1511262b926662929196c3fe
libstdc++: Optimize std::bitset<N>::to_string

This makes to_string approximately twice as fast at any optimization
level. Instead of iterating through every bit, jump straight to the next
bit that is set, by using _Find_first and _Find_next.

libstdc++-v3/ChangeLog:

* include/std/bitset (bitset::_M_copy_to_string): Find set bits
instead of iterating over individual bits.
libstdc++-v3/include/std/bitset