diff --git a/GPA675Lab1GOL/GOLTeamH.cpp b/GPA675Lab1GOL/GOLTeamH.cpp index 1104c63..bca57ba 100644 --- a/GPA675Lab1GOL/GOLTeamH.cpp +++ b/GPA675Lab1GOL/GOLTeamH.cpp @@ -673,14 +673,14 @@ size_t GOLTeamH::countNeighbors(const uint8_t* cellPtr) const // Petit lambda pour simplifier les opérations. auto putInBounds = [width, height, bm, firstGridPtr, lastGridPtr](const uint8_t* ptr) { if (ptr < firstGridPtr) - ptr += width * ((bm == GOL::BorderManagement::mirror) ? 2 : (height - 1)); + ptr += width * ((bm == GOL::BorderManagement::mirror) ? 2 : height); 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) - ptr -= ((bm == GOL::BorderManagement::mirror) ? 2 : (width - 1)); + ptr -= ((bm == GOL::BorderManagement::mirror) ? 2 : width); else if ((ptr - firstGridPtr) % width == width - 1) - ptr += ((bm == GOL::BorderManagement::mirror) ? 2 : (width - 1)); + ptr += ((bm == GOL::BorderManagement::mirror) ? 2 : width); return ptr; }; diff --git a/GPA675Lab1GOL/GridTeamH.cpp b/GPA675Lab1GOL/GridTeamH.cpp index 4d2ddf6..747e991 100644 --- a/GPA675Lab1GOL/GridTeamH.cpp +++ b/GPA675Lab1GOL/GridTeamH.cpp @@ -274,7 +274,5 @@ void GridTeamH::fillBorderOperation(DataType ptr, CellType value) const void GridTeamH::switchToIntermediate() { // Swap pour la performance. - auto* temp{ mData }; - mData = mIntermediateData; - mIntermediateData = temp; + std::swap(mData, mIntermediateData); }