Skip to content

Commit 2b35b92

Browse files
committed
Fixed #1.
1 parent 1bf1435 commit 2b35b92

File tree

4 files changed

+15
-9
lines changed

4 files changed

+15
-9
lines changed

benchmarks/src/BenchmarkGrid.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class GridGraphGenerator
3535
using Func2T = std::function<TValue(TValue,TValue)>;
3636

3737
using SignalVectT = std::vector<MySignal>;
38-
using WidthVectT = std::vector<int>;
38+
using WidthVectT = std::vector<size_t>;
3939

4040
SignalVectT InputSignals;
4141
SignalVectT OutputSignals;
@@ -56,9 +56,9 @@ class GridGraphGenerator
5656
SignalVectT* curBuf = &buf1;
5757
SignalVectT* nextBuf = &buf2;
5858

59-
int curWidth = InputSignals.size();
59+
size_t curWidth = InputSignals.size();
6060

61-
int nodeCount = 1;
61+
size_t nodeCount = 1;
6262
nodeCount += curWidth;
6363

6464
for (auto targetWidth : Widths)

benchmarks/src/BenchmarkLifeSim.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ struct Benchmark_LifeSim : public BenchmarkBase<D>
288288
vector<unique_ptr<Animal<D>>> animals;
289289

290290
std::mt19937 gen( 2015 );
291-
std::uniform_int_distribution<unsigned> dist( 0u, theWorld.Regions.size()-1 );
291+
std::uniform_int_distribution<size_t> dist( 0u, theWorld.Regions.size()-1 );
292292

293293
for (int i=0; i<params.N; i++)
294294
{

src/engine/PulsecountEngine.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,13 +207,16 @@ template <typename TTask, typename TIt, typename ... TArgs>
207207
void spawnTasks
208208
(
209209
task& rootTask, task_list& spawnList,
210-
const uint count, TIt start, TIt end,
210+
const size_t count, TIt start, TIt end,
211211
TArgs& ... args
212212
)
213213
{
214-
rootTask.set_ref_count(1 + count);
214+
assert(1 + count <=
215+
static_cast<size_t>((std::numeric_limits<int>::max)()));
215216

216-
for (uint i=0; i < (count - 1); i++)
217+
rootTask.set_ref_count(1 + static_cast<int>(count));
218+
219+
for (size_t i=0; i < (count - 1); i++)
217220
{
218221
spawnList.push_back(*new(rootTask.allocate_child())
219222
TTask(args ..., start, start + chunk_size));
@@ -230,7 +233,7 @@ void spawnTasks
230233

231234
void EngineBase::Propagate(Turn& turn)
232235
{
233-
const uint initialTaskCount = (changedInputs_.size() - 1) / chunk_size + 1;
236+
const size_t initialTaskCount = (changedInputs_.size() - 1) / chunk_size + 1;
234237

235238
spawnTasks<MarkerTask>(rootTask_, spawnList_, initialTaskCount,
236239
changedInputs_.begin(), changedInputs_.end());

src/engine/SubtreeEngine.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,10 @@ void EngineBase::Propagate(Turn& turn)
178178
// Phase 2
179179
isInPhase2_ = true;
180180

181-
rootTask_.set_ref_count(1 + subtreeRoots_.size());
181+
assert((1 + subtreeRoots_.size()) <=
182+
static_cast<size_t>((std::numeric_limits<int>::max)()));
183+
184+
rootTask_.set_ref_count(1 + static_cast<int>(subtreeRoots_.size()));
182185

183186
for (auto* node : subtreeRoots_)
184187
{

0 commit comments

Comments
 (0)