diff --git a/DataStructures/RangeTable.h b/DataStructures/RangeTable.h index f3c5b48df..1358d3d21 100644 --- a/DataStructures/RangeTable.h +++ b/DataStructures/RangeTable.h @@ -1,15 +1,15 @@ #ifndef __RANGE_TABLE_H__ #define __RANGE_TABLE_H__ +#include "SharedMemoryFactory.h" +#include "SharedMemoryVectorWrapper.h" + #include #include #include #include -#include "SharedMemoryFactory.h" -#include "SharedMemoryVectorWrapper.h" - /* * These pre-declarations are needed because parsing C++ is hard * and otherwise the compiler gets confused. @@ -94,7 +94,7 @@ public: || lengths_prefix_sum == (block_offsets[block_counter]+block_sum)); // block is full - if (block_idx == BLOCK_SIZE) + if (BLOCK_SIZE == block_idx) { diff_blocks.push_back(block); block_counter++; @@ -113,14 +113,14 @@ public: BOOST_ASSERT (block_counter == (number_of_blocks - 1)); // one block missing: starts with guard value - if (block_idx == 0) + if (0 == block_idx) { // the last value is used as sentinel block_offsets.push_back(lengths_prefix_sum); block_idx = (block_idx + 1) % BLOCK_SIZE; } - while (block_idx != 0) + while (0 != block_idx) { block[block_idx - 1] = last_length; last_length = 0; @@ -185,8 +185,10 @@ unsigned RangeTable::PrefixSumAtIndex(int index, // this loop looks inefficent, but a modern compiler // will emit nice SIMD here, at least for sensible block sizes. (I checked.) unsigned sum = 0; - for (int i = 0; i <= index; i++) + for (int i = 0; i <= index; ++i) + { sum += block[i]; + } return sum; }