Skip to content

Commit bb7623b

Browse files
committed
wip: type punning
1 parent c40a60f commit bb7623b

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

src/game/client/hud_closecaption.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@
2323
#include "datacache/idatacache.h"
2424
#include "SoundEmitterSystem/isoundemittersystembase.h"
2525

26-
#ifdef NEO
27-
#include "../common/neo/bit_cast.h"
28-
#endif
2926

3027
// memdbgon must be the last include file in a .cpp file!!!
3128
#include "tier0/memdbgon.h"
@@ -1691,8 +1688,10 @@ void CHudCloseCaption::AddWorkUnit( CCloseCaptionItem *item,
16911688
// params.stream is still in ucs2 format here so just do a basic zero compare for length or just space
16921689
#ifdef NEO
16931690
const auto c = params.stream[0];
1694-
const auto wideC = neo::bit_cast<uint16, decltype(c), true>(c);
1695-
if (wideC != 0 && wideC != 32)
1691+
uint16 punnedC;
1692+
static_assert(sizeof(c) >= sizeof(punnedC));
1693+
memcpy(&punnedC, &c, sizeof(punnedC));
1694+
if (punnedC != 0 && punnedC != 32)
16961695
#else
16971696
if ( ((uint16 *)params.stream)[0] != 0 && ((uint16 *)params.stream)[0] != 32 )
16981697
#endif // NEO

0 commit comments

Comments
 (0)