Skip to content

Commit

Permalink
[Ref] Use mpt::align_down.
Browse files Browse the repository at this point in the history
git-svn-id: https://source.openmpt.org/svn/openmpt/trunk/OpenMPT@22320 56274372-70c3-4bfc-bfc3-4c3a0b034d27
  • Loading branch information
manxorist committed Nov 27, 2024
1 parent 2083567 commit 8ee42f7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion soundlib/MODTools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ PATTERNINDEX GetNumPatterns(FileReader &file, CSoundFile &sndFile, ORDERINDEX nu
// There are some WOW files with an extra byte at the end, and also a MOD file (idntmind.mod, MD5 a3af5c3e1af269e32dfb6677c41c8453, SHA1 4884717c298575f9884b2211c762bb1725f73743)
// where only the "official" patterns should be counted but the file also has an extra byte at the end.
// Since MOD files can technically not have an odd file size, we just always round the actual file size down.
const auto fileSize = file.GetLength() & ~FileReader::pos_type{1};
const auto fileSize = mpt::align_down(file.GetLength(), FileReader::pos_type{2});

if(wowSampleLen && (wowSampleLen + patternStartOffset) + numPatterns * 8 * 256 == fileSize)
{
Expand Down

0 comments on commit 8ee42f7

Please sign in to comment.