Skip to content

Commit

Permalink
fix some UB
Browse files Browse the repository at this point in the history
  • Loading branch information
RSDuck committed Aug 1, 2023
1 parent 3efbf1b commit 7731f66
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/DMA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ void DMA::Reset()
Stall = false;

Running = false;
Executing = false;
InProgress = false;
MRAMBurstCount = 0;
}
Expand Down
7 changes: 4 additions & 3 deletions src/NonStupidBitfield.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,11 @@ struct NonStupidBitField
{
for (u32 i = 0; i < DataLength; i++)
{
u32 idx = __builtin_ctzll(Data[i]);
if (Data[i] && idx + i * 64 < Size)
if (Data[i])
{
return {*this, i, idx, Data[i] & ~(1ULL << idx)};
u32 idx = __builtin_ctzll(Data[i]);
if (idx + i * 64 < Size)
return {*this, i, idx, Data[i] & ~(1ULL << idx)};
}
}
return End();
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/qt_sdl/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ ConfigEntry ConfigFile[] =
{"AudioInterp", 0, &AudioInterp, 0, false},
{"AudioBitDepth", 0, &AudioBitDepth, 0, false},
{"AudioVolume", 0, &AudioVolume, 256, true},
{"DSiVolumeSync", 0, &DSiVolumeSync, 0, true},
{"DSiVolumeSync", 1, &DSiVolumeSync, false, true},
{"MicInputType", 0, &MicInputType, 1, false},
{"MicDevice", 2, &MicDevice, (std::string)"", false},
{"MicWavPath", 2, &MicWavPath, (std::string)"", false},
Expand Down
1 change: 1 addition & 0 deletions src/frontend/qt_sdl/ROMManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@ void UnloadCheats()
{
delete CheatFile;
CheatFile = nullptr;
AREngine::SetCodeFile(nullptr);
}
}

Expand Down

0 comments on commit 7731f66

Please sign in to comment.