From cc3fcda9f807ec0e1d2b12291b05356da5db2e08 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Sat, 5 Oct 2013 19:12:03 +0200 Subject: [PATCH] Simplify implementations --- glm/core/func_packing.inl | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/glm/core/func_packing.inl b/glm/core/func_packing.inl index eab7753f..4821a358 100644 --- a/glm/core/func_packing.inl +++ b/glm/core/func_packing.inl @@ -35,24 +35,24 @@ namespace glm GLM_FUNC_QUALIFIER uint packUnorm2x16(vec2 const & v) { u16vec2 Topack(round(clamp(v, 0.0f, 1.0f) * 65535.0f)); - return *reinterpret_cast(&Topack); + return reinterpret_cast(Topack); } GLM_FUNC_QUALIFIER vec2 unpackUnorm2x16(uint const & p) { - vec2 Unpack(*reinterpret_cast(const_cast(&p))); + vec2 Unpack(reinterpret_cast(p)); return Unpack * float(1.5259021896696421759365224689097e-5); // 1.0 / 65535.0 } GLM_FUNC_QUALIFIER uint packSnorm2x16(vec2 const & v) { i16vec2 Topack(round(clamp(v ,-1.0f, 1.0f) * 32767.0f)); - return *reinterpret_cast(&Topack); + return reinterpret_cast(Topack); } GLM_FUNC_QUALIFIER vec2 unpackSnorm2x16(uint const & p) { - vec2 Unpack(*reinterpret_cast(const_cast(&p))); + vec2 Unpack(reinterpret_cast(p)); return clamp( Unpack * 3.0518509475997192297128208258309e-5f, //1.0f / 32767.0f, -1.0f, 1.0f); @@ -61,24 +61,24 @@ namespace glm GLM_FUNC_QUALIFIER uint packUnorm4x8(vec4 const & v) { u8vec4 Topack(round(clamp(v, 0.0f, 1.0f) * 255.0f)); - return *reinterpret_cast(&Topack); + return reinterpret_cast(&Topack); } GLM_FUNC_QUALIFIER vec4 unpackUnorm4x8(uint const & p) { - vec4 Unpack(*reinterpret_cast(const_cast(&p))); + vec4 Unpack(reinterpret_cast(p)); return Unpack * float(0.0039215686274509803921568627451); // 1 / 255 } GLM_FUNC_QUALIFIER uint packSnorm4x8(vec4 const & v) { i8vec4 Topack(round(clamp(v ,-1.0f, 1.0f) * 127.0f)); - return *reinterpret_cast(&Topack); + return reinterpret_cast(Topack); } GLM_FUNC_QUALIFIER glm::vec4 unpackSnorm4x8(uint const & p) { - vec4 Unpack(*reinterpret_cast(const_cast(&p))); + vec4 Unpack(reinterpret_cast(p)); return clamp( Unpack * 0.0078740157480315f, // 1.0f / 127.0f -1.0f, 1.0f); @@ -86,12 +86,12 @@ namespace glm GLM_FUNC_QUALIFIER double packDouble2x32(uvec2 const & v) { - return *reinterpret_cast(const_cast(&v)); + return reinterpret_cast(v); } GLM_FUNC_QUALIFIER uvec2 unpackDouble2x32(double const & v) { - return *reinterpret_cast(const_cast(&v)); + return reinterpret_cast(v); } GLM_FUNC_QUALIFIER uint packHalf2x16(vec2 const & v) @@ -105,7 +105,7 @@ namespace glm GLM_FUNC_QUALIFIER vec2 unpackHalf2x16(uint const & v) { - i16vec2 Unpack = *reinterpret_cast(const_cast(&v)); + i16vec2 Unpack(reinterpret_cast(v)); return vec2( detail::toFloat32(Unpack.x),