Répare complètement le fonctionnement de warping/mirror
This commit is contained in:
parent
20498ae56e
commit
8d128b01ce
@ -673,14 +673,14 @@ size_t GOLTeamH::countNeighbors(const uint8_t* cellPtr) const
|
|||||||
// Petit lambda pour simplifier les opérations.
|
// Petit lambda pour simplifier les opérations.
|
||||||
auto putInBounds = [width, height, bm, firstGridPtr, lastGridPtr](const uint8_t* ptr) {
|
auto putInBounds = [width, height, bm, firstGridPtr, lastGridPtr](const uint8_t* ptr) {
|
||||||
if (ptr < firstGridPtr)
|
if (ptr < firstGridPtr)
|
||||||
ptr += width * ((bm == GOL::BorderManagement::mirror) ? 2 : (height - 1));
|
ptr += width * ((bm == GOL::BorderManagement::mirror) ? 2 : height);
|
||||||
else if (ptr > lastGridPtr)
|
else if (ptr > lastGridPtr)
|
||||||
ptr -= width * ((bm == GOL::BorderManagement::mirror) ? 2 : (height - 1));
|
ptr -= width * ((bm == GOL::BorderManagement::mirror) ? 2 : height);
|
||||||
|
|
||||||
if ((ptr - firstGridPtr) % width == 0)
|
if ((ptr - firstGridPtr) % width == 0)
|
||||||
ptr -= ((bm == GOL::BorderManagement::mirror) ? 2 : (width - 1));
|
ptr -= ((bm == GOL::BorderManagement::mirror) ? 2 : width);
|
||||||
else if ((ptr - firstGridPtr) % width == width - 1)
|
else if ((ptr - firstGridPtr) % width == width - 1)
|
||||||
ptr += ((bm == GOL::BorderManagement::mirror) ? 2 : (width - 1));
|
ptr += ((bm == GOL::BorderManagement::mirror) ? 2 : width);
|
||||||
|
|
||||||
return ptr;
|
return ptr;
|
||||||
};
|
};
|
||||||
|
@ -274,7 +274,5 @@ void GridTeamH::fillBorderOperation(DataType ptr, CellType value) const
|
|||||||
void GridTeamH::switchToIntermediate()
|
void GridTeamH::switchToIntermediate()
|
||||||
{
|
{
|
||||||
// Swap pour la performance.
|
// Swap pour la performance.
|
||||||
auto* temp{ mData };
|
std::swap(mData, mIntermediateData);
|
||||||
mData = mIntermediateData;
|
|
||||||
mIntermediateData = temp;
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user