MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / combineWith

Method combineWith

source/core/StarByteArray.hpp:194–214  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

192
193template <typename Combiner>
194ByteArray ByteArray::combineWith(Combiner&& combine, ByteArray const& rhs, bool extend) {
195 ByteArray const* smallerArray = &rhs;
196 ByteArray const* largerArray = this;
197
198 if (m_size < rhs.size())
199 swap(smallerArray, largerArray);
200
201 ByteArray res;
202 res.resize(smallerArray->size());
203
204 for (size_t i = 0; i < smallerArray->size(); ++i)
205 res[i] = combine((*smallerArray)[i], (*largerArray)[i]);
206
207 if (extend) {
208 res.resize(largerArray->size());
209 for (size_t i = smallerArray->size(); i < largerArray->size(); ++i)
210 res[i] = (*largerArray)[i];
211 }
212
213 return res;
214}
215
216inline ByteArray::iterator ByteArray::begin() {
217 return m_data;

Callers

nothing calls this directly

Calls 2

sizeMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected