MCPcopy Create free account
hub / github.com/devosoft/avida / INCREMENT

Method INCREMENT

avida-core/source/tools/cBitArray.cc:287–301  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

285}
286
287void cRawBitArray::INCREMENT(const int num_bits)
288{
289 const int num_fields = GetNumFields(num_bits);
290 int i = 0;
291 for (i = 0; i < num_fields; i++) {
292 bit_fields[i]++;
293 if (bit_fields[i] != 0) { break; } // no overflow, do not need to increment higher fields
294 }
295
296 // if highest bit field was incremented, mask out any unused portions of the field so as not to confuse CountBits
297 if (i == num_fields - 1) {
298 unsigned int shift_mask = 0xffffffff >> (32 - (num_bits % 32));
299 bit_fields[num_fields - 1] &= shift_mask;
300 }
301}
302
303
304

Callers 3

cBitArrayClass · 0.80
mainFunction · 0.80
RunTestsMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected