mirror of
https://github.com/g-truc/glm.git
synced 2024-11-26 18:24:35 +00:00
fix: reinterpret_cast to explicit conversions #1123
This commit is contained in:
parent
f1bfe6cc95
commit
46818dccca
@ -424,7 +424,7 @@ namespace glm
|
|||||||
///
|
///
|
||||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/floatBitsToUint.xml">GLSL floatBitsToUint man page</a>
|
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/floatBitsToUint.xml">GLSL floatBitsToUint man page</a>
|
||||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||||
GLM_FUNC_DECL uint floatBitsToUint(float const& v);
|
GLM_FUNC_DECL uint floatBitsToUint(float v);
|
||||||
|
|
||||||
/// Returns a unsigned integer value representing
|
/// Returns a unsigned integer value representing
|
||||||
/// the encoding of a floating-point value. The floatingpoint
|
/// the encoding of a floating-point value. The floatingpoint
|
||||||
@ -446,7 +446,7 @@ namespace glm
|
|||||||
///
|
///
|
||||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/intBitsToFloat.xml">GLSL intBitsToFloat man page</a>
|
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/intBitsToFloat.xml">GLSL intBitsToFloat man page</a>
|
||||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||||
GLM_FUNC_DECL float intBitsToFloat(int const& v);
|
GLM_FUNC_DECL float intBitsToFloat(int v);
|
||||||
|
|
||||||
/// Returns a floating-point value corresponding to a signed
|
/// Returns a floating-point value corresponding to a signed
|
||||||
/// integer encoding of a floating-point value.
|
/// integer encoding of a floating-point value.
|
||||||
@ -470,7 +470,7 @@ namespace glm
|
|||||||
///
|
///
|
||||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/uintBitsToFloat.xml">GLSL uintBitsToFloat man page</a>
|
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/uintBitsToFloat.xml">GLSL uintBitsToFloat man page</a>
|
||||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||||
GLM_FUNC_DECL float uintBitsToFloat(uint const& v);
|
GLM_FUNC_DECL float uintBitsToFloat(uint v);
|
||||||
|
|
||||||
/// Returns a floating-point value corresponding to a
|
/// Returns a floating-point value corresponding to a
|
||||||
/// unsigned integer encoding of a floating-point value.
|
/// unsigned integer encoding of a floating-point value.
|
||||||
|
@ -662,7 +662,7 @@ namespace detail
|
|||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER int floatBitsToInt(float const& v)
|
GLM_FUNC_QUALIFIER int floatBitsToInt(float v)
|
||||||
{
|
{
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
@ -678,10 +678,10 @@ namespace detail
|
|||||||
template<length_t L, qualifier Q>
|
template<length_t L, qualifier Q>
|
||||||
GLM_FUNC_QUALIFIER vec<L, int, Q> floatBitsToInt(vec<L, float, Q> const& v)
|
GLM_FUNC_QUALIFIER vec<L, int, Q> floatBitsToInt(vec<L, float, Q> const& v)
|
||||||
{
|
{
|
||||||
return reinterpret_cast<vec<L, int, Q>&>(const_cast<vec<L, float, Q>&>(v));
|
return detail::functor1<vec, L, int, float, Q>::call(floatBitsToInt, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER uint floatBitsToUint(float const& v)
|
GLM_FUNC_QUALIFIER uint floatBitsToUint(float v)
|
||||||
{
|
{
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
@ -697,7 +697,7 @@ namespace detail
|
|||||||
template<length_t L, qualifier Q>
|
template<length_t L, qualifier Q>
|
||||||
GLM_FUNC_QUALIFIER vec<L, uint, Q> floatBitsToUint(vec<L, float, Q> const& v)
|
GLM_FUNC_QUALIFIER vec<L, uint, Q> floatBitsToUint(vec<L, float, Q> const& v)
|
||||||
{
|
{
|
||||||
return reinterpret_cast<vec<L, uint, Q>&>(const_cast<vec<L, float, Q>&>(v));
|
return detail::functor1<vec, L, uint, float, Q>::call(floatBitsToUint, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER float intBitsToFloat(int const& v)
|
GLM_FUNC_QUALIFIER float intBitsToFloat(int const& v)
|
||||||
@ -716,10 +716,10 @@ namespace detail
|
|||||||
template<length_t L, qualifier Q>
|
template<length_t L, qualifier Q>
|
||||||
GLM_FUNC_QUALIFIER vec<L, float, Q> intBitsToFloat(vec<L, int, Q> const& v)
|
GLM_FUNC_QUALIFIER vec<L, float, Q> intBitsToFloat(vec<L, int, Q> const& v)
|
||||||
{
|
{
|
||||||
return reinterpret_cast<vec<L, float, Q>&>(const_cast<vec<L, int, Q>&>(v));
|
return detail::functor1<vec, L, float, int, Q>::call(intBitsToFloat, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER float uintBitsToFloat(uint const& v)
|
GLM_FUNC_QUALIFIER float uintBitsToFloat(uint v)
|
||||||
{
|
{
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
|
@ -317,7 +317,7 @@ namespace detail
|
|||||||
# pragma warning(disable : 4310) //cast truncates constant value
|
# pragma warning(disable : 4310) //cast truncates constant value
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
vec<L, typename detail::make_unsigned<T>::type, Q> x(*reinterpret_cast<vec<L, typename detail::make_unsigned<T>::type, Q> const *>(&v));
|
vec<L, typename detail::make_unsigned<T>::type, Q> x(v);
|
||||||
x = detail::compute_bitfieldBitCountStep<L, typename detail::make_unsigned<T>::type, Q, detail::is_aligned<Q>::value, sizeof(T) * 8>= 2>::call(x, typename detail::make_unsigned<T>::type(0x5555555555555555ull), typename detail::make_unsigned<T>::type( 1));
|
x = detail::compute_bitfieldBitCountStep<L, typename detail::make_unsigned<T>::type, Q, detail::is_aligned<Q>::value, sizeof(T) * 8>= 2>::call(x, typename detail::make_unsigned<T>::type(0x5555555555555555ull), typename detail::make_unsigned<T>::type( 1));
|
||||||
x = detail::compute_bitfieldBitCountStep<L, typename detail::make_unsigned<T>::type, Q, detail::is_aligned<Q>::value, sizeof(T) * 8>= 4>::call(x, typename detail::make_unsigned<T>::type(0x3333333333333333ull), typename detail::make_unsigned<T>::type( 2));
|
x = detail::compute_bitfieldBitCountStep<L, typename detail::make_unsigned<T>::type, Q, detail::is_aligned<Q>::value, sizeof(T) * 8>= 4>::call(x, typename detail::make_unsigned<T>::type(0x3333333333333333ull), typename detail::make_unsigned<T>::type( 2));
|
||||||
x = detail::compute_bitfieldBitCountStep<L, typename detail::make_unsigned<T>::type, Q, detail::is_aligned<Q>::value, sizeof(T) * 8>= 8>::call(x, typename detail::make_unsigned<T>::type(0x0F0F0F0F0F0F0F0Full), typename detail::make_unsigned<T>::type( 4));
|
x = detail::compute_bitfieldBitCountStep<L, typename detail::make_unsigned<T>::type, Q, detail::is_aligned<Q>::value, sizeof(T) * 8>= 8>::call(x, typename detail::make_unsigned<T>::type(0x0F0F0F0F0F0F0F0Full), typename detail::make_unsigned<T>::type( 4));
|
||||||
|
Loading…
Reference in New Issue
Block a user