mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 11:42:57 +01:00
use memcpy instead of dubious union to type pun two values,
thanks to David Blaike for pointing this out. llvm-svn: 175032
This commit is contained in:
parent
49b50f690c
commit
4eca27141d
@ -364,16 +364,17 @@ public:
|
|||||||
uint32_t R = uint32_t(CurWord);
|
uint32_t R = uint32_t(CurWord);
|
||||||
|
|
||||||
// Read the next word from the stream.
|
// Read the next word from the stream.
|
||||||
union {
|
uint8_t Array[sizeof(word_t)] = {0};
|
||||||
uint8_t ArrayMember[sizeof(word_t)];
|
|
||||||
support::detail::packed_endian_specific_integral
|
BitStream->getBitcodeBytes().readBytes(NextChar, sizeof(Array),
|
||||||
<word_t, support::little, support::unaligned> EndianMember;
|
Array, NULL);
|
||||||
} buf = { { 0 } };
|
|
||||||
|
|
||||||
BitStream->getBitcodeBytes().readBytes(NextChar, sizeof(buf),
|
|
||||||
buf.ArrayMember, NULL);
|
|
||||||
// Handle big-endian byte-swapping if necessary.
|
// Handle big-endian byte-swapping if necessary.
|
||||||
CurWord = buf.EndianMember;
|
support::detail::packed_endian_specific_integral
|
||||||
|
<word_t, support::little, support::unaligned> EndianValue;
|
||||||
|
memcpy(&EndianValue, Array, sizeof(Array));
|
||||||
|
|
||||||
|
CurWord = EndianValue;
|
||||||
|
|
||||||
NextChar += sizeof(word_t);
|
NextChar += sizeof(word_t);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user