Skip to content

Commit

Permalink
Fix increment UB
Browse files Browse the repository at this point in the history
Can't modify a value twice between sequence points.
  • Loading branch information
sndels committed Aug 3, 2024
1 parent 11d0713 commit 2b2e82f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/render/RtReference.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ RtReference::Output RtReference::record(

PROFILER_CPU_SCOPE("RtReference");

m_frameIndex = ++m_frameIndex % sFramePeriod;
m_frameIndex = (m_frameIndex + 1) % sFramePeriod;

Output ret;
{
Expand Down
2 changes: 1 addition & 1 deletion src/render/rtdi/RtDiInitialReservoirs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ RtDiInitialReservoirs::Output RtDiInitialReservoirs::record(

PROFILER_CPU_SCOPE(" InitialReservoirs");

m_frameIndex = ++m_frameIndex % sFramePeriod;
m_frameIndex = (m_frameIndex + 1) % sFramePeriod;

Output ret;
{
Expand Down
2 changes: 1 addition & 1 deletion src/render/rtdi/RtDiTrace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ RtDiTrace::Output RtDiTrace::record(

PROFILER_CPU_SCOPE(" Trace");

m_frameIndex = ++m_frameIndex % sFramePeriod;
m_frameIndex = (m_frameIndex + 1) % sFramePeriod;

Output ret;
{
Expand Down

0 comments on commit 2b2e82f

Please sign in to comment.