mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-08 23:29:53 +01:00
Removed unnecessary union name
This commit is contained in:
parent
be890d0c15
commit
46a1fc7615
@ -83,17 +83,16 @@ namespace Detail {
|
|||||||
// Does not consider endian-ness
|
// Does not consider endian-ness
|
||||||
template<typename T>
|
template<typename T>
|
||||||
std::string rawMemoryToString( T value ) {
|
std::string rawMemoryToString( T value ) {
|
||||||
union
|
union {
|
||||||
{
|
T typedValue;
|
||||||
T value;
|
|
||||||
unsigned char bytes[sizeof(T)];
|
unsigned char bytes[sizeof(T)];
|
||||||
} valueAsBuffer;
|
};
|
||||||
|
|
||||||
valueAsBuffer.value = value;
|
typedValue = value;
|
||||||
|
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
oss << "0x";
|
oss << "0x";
|
||||||
for( unsigned char* cp = valueAsBuffer.bytes; cp < valueAsBuffer.bytes+sizeof(T); ++cp )
|
for( unsigned char* cp = bytes; cp < bytes+sizeof(T); ++cp )
|
||||||
oss << std::hex << std::setw(2) << std::setfill('0') << (unsigned int)*cp;
|
oss << std::hex << std::setw(2) << std::setfill('0') << (unsigned int)*cp;
|
||||||
return oss.str();
|
return oss.str();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user