mirror of
https://github.com/KhronosGroup/SPIRV-Tools
synced 2024-11-27 22:00:07 +00:00
Aliasing through a union member is valid.
Take back my previous TODO.
This commit is contained in:
parent
15afbf9372
commit
c9e0845c7f
@ -33,7 +33,9 @@ enum {
|
|||||||
I32_ENDIAN_BIG = 0x00010203ul,
|
I32_ENDIAN_BIG = 0x00010203ul,
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO(dneto): This relies on undefined behaviour. Fix that.
|
// This constant value allows the detection of the host machine's endianness.
|
||||||
|
// Accessing it through the "value" member is valid due to C++11 section 3.10
|
||||||
|
// paragraph 10.
|
||||||
static const union {
|
static const union {
|
||||||
unsigned char bytes[4];
|
unsigned char bytes[4];
|
||||||
uint32_t value;
|
uint32_t value;
|
||||||
|
@ -61,8 +61,6 @@ enum {
|
|||||||
I32_ENDIAN_BIG = 0x00010203ul,
|
I32_ENDIAN_BIG = 0x00010203ul,
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO(dneto): Using a union this way relies on undefined behaviour.
|
|
||||||
// Replace this with uses of BitwiseCast from util/bitutils.h
|
|
||||||
static const union {
|
static const union {
|
||||||
unsigned char bytes[4];
|
unsigned char bytes[4];
|
||||||
uint32_t value;
|
uint32_t value;
|
||||||
|
Loading…
Reference in New Issue
Block a user