[Base] Move float/double to_hex_string implementation out of header. Maybe fix Travis complaining.
This commit is contained in:
parent
1ebf7bb484
commit
36bd0df586
|
@ -33,6 +33,24 @@ inline std::string to_hex_string(uint64_t value) {
|
||||||
return std::string(buffer);
|
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) {
|
inline std::string to_hex_string(const vec128_t& value) {
|
||||||
char buffer[128];
|
char buffer[128];
|
||||||
std::snprintf(buffer, sizeof(buffer), "[%.8X, %.8X, %.8X, %.8X]",
|
std::snprintf(buffer, sizeof(buffer), "[%.8X, %.8X, %.8X, %.8X]",
|
||||||
|
|
|
@ -24,25 +24,8 @@ namespace string_util {
|
||||||
|
|
||||||
extern inline std::string to_hex_string(uint32_t value);
|
extern inline std::string to_hex_string(uint32_t value);
|
||||||
extern inline std::string to_hex_string(uint64_t value);
|
extern inline std::string to_hex_string(uint64_t value);
|
||||||
|
extern inline std::string to_hex_string(float value);
|
||||||
inline std::string to_hex_string(float value) {
|
extern inline std::string to_hex_string(double 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(const vec128_t& value);
|
extern inline std::string to_hex_string(const vec128_t& value);
|
||||||
|
|
||||||
#if XE_ARCH_AMD64
|
#if XE_ARCH_AMD64
|
||||||
|
|
Loading…
Reference in New Issue