Fix some minor style issues

This commit is contained in:
Patrick Niklaus 2014-06-15 11:04:10 +02:00
parent aedcc2ff40
commit e29b7a6eae

View File

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