Fixed string_cast, broken after fixing #916

This commit is contained in:
Christophe 2019-07-12 23:11:27 +02:00
parent 69622b2954
commit 947527d3ac
2 changed files with 14 additions and 13 deletions

View File

@ -441,7 +441,7 @@ namespace detail
template<typename T, qualifier Q> template<typename T, qualifier Q>
struct compute_to_string<qua<T, Q> > struct compute_to_string<qua<T, Q> >
{ {
GLM_FUNC_QUALIFIER static std::string call(qua<T, Q> const& x) GLM_FUNC_QUALIFIER static std::string call(qua<T, Q> const& q)
{ {
char const * PrefixStr = prefix<T>::value(); char const * PrefixStr = prefix<T>::value();
char const * LiteralStr = literal<T, std::numeric_limits<T>::is_iec559>::value(); char const * LiteralStr = literal<T, std::numeric_limits<T>::is_iec559>::value();
@ -450,10 +450,10 @@ namespace detail
LiteralStr, LiteralStr, LiteralStr, LiteralStr)); LiteralStr, LiteralStr, LiteralStr, LiteralStr));
return detail::format(FormatStr.c_str(), return detail::format(FormatStr.c_str(),
static_cast<typename cast<T>::value_type>(x[0]), static_cast<typename cast<T>::value_type>(q.w),
static_cast<typename cast<T>::value_type>(x[1]), static_cast<typename cast<T>::value_type>(q.x),
static_cast<typename cast<T>::value_type>(x[2]), static_cast<typename cast<T>::value_type>(q.y),
static_cast<typename cast<T>::value_type>(x[3])); static_cast<typename cast<T>::value_type>(q.z));
} }
}; };
@ -470,14 +470,14 @@ namespace detail
LiteralStr, LiteralStr, LiteralStr, LiteralStr)); LiteralStr, LiteralStr, LiteralStr, LiteralStr));
return detail::format(FormatStr.c_str(), return detail::format(FormatStr.c_str(),
static_cast<typename cast<T>::value_type>(x.real[0]), static_cast<typename cast<T>::value_type>(x.real.w),
static_cast<typename cast<T>::value_type>(x.real[1]), static_cast<typename cast<T>::value_type>(x.real.x),
static_cast<typename cast<T>::value_type>(x.real[2]), static_cast<typename cast<T>::value_type>(x.real.y),
static_cast<typename cast<T>::value_type>(x.real[3]), static_cast<typename cast<T>::value_type>(x.real.z),
static_cast<typename cast<T>::value_type>(x.dual[0]), static_cast<typename cast<T>::value_type>(x.dual.w),
static_cast<typename cast<T>::value_type>(x.dual[1]), static_cast<typename cast<T>::value_type>(x.dual.x),
static_cast<typename cast<T>::value_type>(x.dual[2]), static_cast<typename cast<T>::value_type>(x.dual.y),
static_cast<typename cast<T>::value_type>(x.dual[3])); static_cast<typename cast<T>::value_type>(x.dual.z));
} }
}; };

View File

@ -143,6 +143,7 @@ int test_string_cast_dual_quaternion()
int main() int main()
{ {
int Error = 0; int Error = 0;
Error += test_string_cast_vector(); Error += test_string_cast_vector();
Error += test_string_cast_matrix(); Error += test_string_cast_matrix();
Error += test_string_cast_quaternion(); Error += test_string_cast_quaternion();