diasurgical / devilution

Diablo devolved - magic behind the 1996 computer game
Other
8.66k stars 921 forks source link

Remove global optimizations for SHA1ProcessMessageBlock() #2293

Closed StephenCWills closed 2 months ago

StephenCWills commented 2 months ago

I recently noticed that save files from my Debug builds in Visual Studio 2022 were incompatible with my Release builds and vice-versa. I tracked it down to the Global Optimizations flag (/Og) in the compiler, which is included in the list of optimizations turned on by both /O1 and /O2.

My version of MSVC in VS2022 is _MSC_VER == 1939. I figured this was caused by a fairly recent change in MSVC so I tested in VS2019 _MSC_VER == 1929 as well. The optimization works fine in VS2019 so in lieu of trying to install and test every version of VS2022 to narrow it down further, I just disabled the optimization for this one function for all versions of VS2022.