[Base] Move float/double to_hex_string implementation out of header. Maybe fix Travis complaining.

This commit is contained in:
gibbed 2019-08-04 11:38:01 -05:00
parent 1ebf7bb484
commit 36bd0df586
2 changed files with 20 additions and 19 deletions

View File

@ -33,6 +33,24 @@ inline std::string to_hex_string(uint64_t value) {
return std::string(buffer);
}
inline std::string to_hex_string(float value) {
union {
uint32_t ui;
float flt;
} v;
v.flt = value;
return to_hex_string(v.ui);
}
inline std::string to_hex_string(double value) {
union {
uint64_t ui;
double dbl;
} v;
v.dbl = value;
return to_hex_string(v.ui);
}
inline std::string to_hex_string(const vec128_t& value) {
char buffer[128];
std::snprintf(buffer, sizeof(buffer), "[%.8X, %.8X, %.8X, %.8X]",

View File

@ -24,25 +24,8 @@ namespace string_util {
extern inline std::string to_hex_string(uint32_t value);
extern inline std::string to_hex_string(uint64_t value);
inline std::string to_hex_string(float value) {
union {
uint32_t ui;
float flt;
} v;
v.flt = value;
return to_hex_string(v.ui);
}
inline std::string to_hex_string(double value) {
union {
uint64_t ui;
double dbl;
} v;
v.dbl = value;
return to_hex_string(v.ui);
}
extern inline std::string to_hex_string(float value);
extern inline std::string to_hex_string(double value);
extern inline std::string to_hex_string(const vec128_t& value);
#if XE_ARCH_AMD64