Skip to content
Permalink
Browse files

Fix fourcc

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 Apr 6, 2019
1 parent ddaacc5 commit 403e6cb07b8833e9955a0ec5d2b4c3033cf12cab
Showing with 4 additions and 4 deletions.
  1. +4 −4 CorsixTH/Src/th_sound.cpp
@@ -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 {

0 comments on commit 403e6cb

Please sign in to comment.
You can’t perform that action at this time.