Skip to content

Commit

Permalink
Fix fourcc
Browse files Browse the repository at this point in the history
Had implementation defined behaviour because the cast to uint32_t wasn't
happening until after the bitshift; which meant that it was casting to 'int'
instead.
  • Loading branch information
TheCycoONE committed May 27, 2019
1 parent ddaacc5 commit 403e6cb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions CorsixTH/Src/th_sound.cpp
Expand Up @@ -99,10 +99,10 @@ const char* sound_archive::get_sound_name(size_t iIndex) const
constexpr uint32_t fourcc(const char c1, const char c2, const char c3, const char c4)
{
return (
static_cast<uint32_t>(static_cast<uint8_t>(c1) << 0)
| static_cast<uint32_t>(static_cast<uint8_t>(c2) << 8)
| static_cast<uint32_t>(static_cast<uint8_t>(c3) << 16)
| static_cast<uint32_t>(static_cast<uint8_t>(c4) << 24));
(static_cast<uint32_t>(static_cast<uint8_t>(c1)) << 0)
| (static_cast<uint32_t>(static_cast<uint8_t>(c2)) << 8)
| (static_cast<uint32_t>(static_cast<uint8_t>(c3)) << 16)
| (static_cast<uint32_t>(static_cast<uint8_t>(c4)) << 24));
}

namespace {
Expand Down

0 comments on commit 403e6cb

Please sign in to comment.