Ticket #6164: msg1122.txt

File msg1122.txt, 1.3 KB (added by Chris Kingsley <chris.kingsley@…>, 11 years ago)

a diff of current dynamic_bitset.hpp and my changed version

Line 
1--- boost_1_44_0/boost/dynamic_bitset/dynamic_bitset.hpp 2011-08-22 13:37:32.928051000 -0700
2+++ /home/kingsley/Lnk/f7opt/mydynamic_bitset.hpp 2011-11-22 11:07:51.912857000 -0800
3@@ -270,6 +270,7 @@
4 dynamic_bitset& flip(size_type n);
5 dynamic_bitset& flip();
6 bool test(size_type n) const;
7+ bool test_set(size_type n);
8 bool any() const;
9 bool none() const;
10 dynamic_bitset operator~() const;
11@@ -414,6 +415,7 @@
12 BOOST_DYNAMIC_BITSET_PRIVATE:
13
14 bool m_unchecked_test(size_type pos) const;
15+ bool m_unchecked_test_set(size_type pos);
16 static size_type calc_num_blocks(size_type num_bits);
17
18 Block& m_highest_block();
19@@ -967,6 +969,23 @@
20 }
21
22 template <typename Block, typename Allocator>
23+bool dynamic_bitset<Block, Allocator>::m_unchecked_test_set(size_type pos)
24+{
25+ Block& mem=m_bits[block_index(pos)];
26+ Block msk=bit_mask(pos);
27+ Block res=mem;
28+ mem |= msk;
29+ return (bool)(res & msk);
30+}
31+
32+template <typename Block, typename Allocator>
33+bool dynamic_bitset<Block, Allocator>::test_set(size_type pos)
34+{
35+ assert(pos < m_num_bits);
36+ return m_unchecked_test_set(pos);
37+}
38+
39+template <typename Block, typename Allocator>
40 bool dynamic_bitset<Block, Allocator>::any() const
41 {
42 for (size_type i = 0; i < num_blocks(); ++i)