diff --git a/src/xenia/base/string_util.cc b/src/xenia/base/string_util.cc index c64820c2e..efeee3fda 100644 --- a/src/xenia/base/string_util.cc +++ b/src/xenia/base/string_util.cc @@ -21,37 +21,19 @@ namespace xe { namespace string_util { -inline std::string to_hex_string(uint32_t value) { +std::string to_hex_string(uint32_t value) { char buffer[21]; std::snprintf(buffer, sizeof(buffer), "%08" PRIX32, value); return std::string(buffer); } -inline std::string to_hex_string(uint64_t value) { +std::string to_hex_string(uint64_t value) { char buffer[21]; std::snprintf(buffer, sizeof(buffer), "%016" PRIX64, 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) { +std::string to_hex_string(const vec128_t& value) { char buffer[128]; std::snprintf(buffer, sizeof(buffer), "[%.8X, %.8X, %.8X, %.8X]", value.u32[0], value.u32[1], value.u32[2], value.u32[3]); @@ -61,7 +43,7 @@ inline std::string to_hex_string(const vec128_t& value) { #if XE_ARCH_AMD64 // TODO(DrChat): This should not exist. Force the caller to use vec128. -inline std::string to_hex_string(const __m128& value) { +std::string to_hex_string(const __m128& value) { char buffer[128]; float f[4]; _mm_storeu_ps(f, value); @@ -72,7 +54,7 @@ inline std::string to_hex_string(const __m128& value) { return std::string(buffer); } -inline std::string to_string(const __m128& value) { +std::string to_string(const __m128& value) { char buffer[128]; float f[4]; _mm_storeu_ps(f, value); diff --git a/src/xenia/base/string_util.h b/src/xenia/base/string_util.h index cd1879e36..c17d14d61 100644 --- a/src/xenia/base/string_util.h +++ b/src/xenia/base/string_util.h @@ -22,17 +22,37 @@ namespace xe { namespace string_util { -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(float value); -extern inline std::string to_hex_string(double value); -extern inline std::string to_hex_string(const vec128_t& value); +// TODO(gibbed): Figure out why clang doesn't line forward declarations of +// inline functions. + +std::string to_hex_string(uint32_t value); +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); +} + +std::string to_hex_string(const vec128_t& value); #if XE_ARCH_AMD64 // TODO(DrChat): This should not exist. Force the caller to use vec128. -extern inline std::string to_hex_string(const __m128& value); -extern inline std::string to_string(const __m128& value); +std::string to_hex_string(const __m128& value); +std::string to_string(const __m128& value); #endif diff --git a/src/xenia/base/vec128.cc b/src/xenia/base/vec128.cc index 14bcfe590..84bff1457 100644 --- a/src/xenia/base/vec128.cc +++ b/src/xenia/base/vec128.cc @@ -16,7 +16,7 @@ namespace xe { -inline std::string to_string(const vec128_t& value) { +std::string to_string(const vec128_t& value) { char buffer[128]; std::snprintf(buffer, sizeof(buffer), "(%g, %g, %g, %g)", value.x, value.y, value.z, value.w); diff --git a/src/xenia/base/vec128.h b/src/xenia/base/vec128.h index 0b0ccaeee..46f0527fb 100644 --- a/src/xenia/base/vec128.h +++ b/src/xenia/base/vec128.h @@ -264,7 +264,10 @@ static inline vec128_t vec128b(uint8_t x0, uint8_t x1, uint8_t x2, uint8_t x3, return v; } -extern inline std::string to_string(const vec128_t& value); +// TODO(gibbed): Figure out why clang doesn't line forward declarations of +// inline functions. + +std::string to_string(const vec128_t& value); } // namespace xe