MCPcopy Create free account
hub / github.com/boostorg/compute / resize

Method resize

include/boost/compute/container/dynamic_bitset.hpp:124–143  ·  view source on GitHub ↗

Resizes the bitset to contain \p num_bits. If the new size is greater than the current size the new bits are set to zero.

Source from the content-addressed store, hash-verified

122 /// Resizes the bitset to contain \p num_bits. If the new size is greater
123 /// than the current size the new bits are set to zero.
124 void resize(size_type num_bits, command_queue &queue)
125 {
126 // resize bits
127 const size_type current_block_count = m_bits.size();
128 m_bits.resize(num_bits * bits_per_block, queue);
129
130 // fill new block with zeros (if new blocks were added)
131 const size_type new_block_count = m_bits.size();
132 if(new_block_count > current_block_count){
133 fill_n(
134 m_bits.begin() + current_block_count,
135 new_block_count - current_block_count,
136 block_type(0),
137 queue
138 );
139 }
140
141 // store new size
142 m_size = num_bits;
143 }
144
145 /// Sets the bit at position \p n to \c true.
146 void set(size_type n, command_queue &queue)

Callers

nothing calls this directly

Calls 3

fill_nFunction · 0.85
sizeMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected