fixed: warning wrt. strict aliasing on gcc 4.8.2/clang3.3
This commit is contained in:
		
							parent
							
								
									ae691ce39a
								
							
						
					
					
						commit
						37e5868200
					
				@ -179,7 +179,11 @@ namespace detail
 | 
			
		||||
			genType xhalf(tmp * genType(0.5f));
 | 
			
		||||
			genUType i = *reinterpret_cast<genUType*>(const_cast<genType*>(&v));
 | 
			
		||||
			i = genUType(0x5f375a86) - (i >> genUType(1));
 | 
			
		||||
			tmp = *reinterpret_cast<genType*>(&i);
 | 
			
		||||
      // tmp = *reinterpret_cast<genType*>(&i);
 | 
			
		||||
      {
 | 
			
		||||
        genType* ptr(reinterpret_cast<genType*>(&i));
 | 
			
		||||
        tmp = *ptr;
 | 
			
		||||
      }
 | 
			
		||||
			tmp = tmp * (genType(1.5f) - xhalf * tmp * tmp);
 | 
			
		||||
			return tmp;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
@ -172,7 +172,8 @@ namespace glm
 | 
			
		||||
 | 
			
		||||
		uint64 Value64 = static_cast<uint64>(x) * static_cast<uint64>(y);
 | 
			
		||||
		msb = *(reinterpret_cast<uint32*>(&Value64) + 1);
 | 
			
		||||
		lsb = reinterpret_cast<uint32&>(Value64);
 | 
			
		||||
		//lsb = reinterpret_cast<uint32&>(Value64);
 | 
			
		||||
    lsb = *(reinterpret_cast<uint32*>(Value64));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	template <>
 | 
			
		||||
@ -231,7 +232,7 @@ namespace glm
 | 
			
		||||
 | 
			
		||||
		int64 Value64 = static_cast<int64>(x) * static_cast<int64>(y);
 | 
			
		||||
		msb = *(reinterpret_cast<int32*>(&Value64) + 1);
 | 
			
		||||
		lsb = reinterpret_cast<int32&>(Value64);
 | 
			
		||||
		// lsb = reinterpret_cast<int32&>(Value64);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	template <>
 | 
			
		||||
 | 
			
		||||
@ -35,7 +35,9 @@ namespace glm
 | 
			
		||||
	GLM_FUNC_QUALIFIER uint packUnorm2x16(vec2 const & v)
 | 
			
		||||
	{
 | 
			
		||||
		u16vec2 Topack(round(clamp(v, 0.0f, 1.0f) * 65535.0f));
 | 
			
		||||
		return reinterpret_cast<uint&>(Topack);
 | 
			
		||||
		// return reinterpret_cast<uint&>(Topack);
 | 
			
		||||
    uint* ptr(reinterpret_cast<uint*>(&Topack));
 | 
			
		||||
    return *ptr;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	GLM_FUNC_QUALIFIER vec2 unpackUnorm2x16(uint const & p)
 | 
			
		||||
@ -47,7 +49,9 @@ namespace glm
 | 
			
		||||
	GLM_FUNC_QUALIFIER uint packSnorm2x16(vec2 const & v)
 | 
			
		||||
	{
 | 
			
		||||
		i16vec2 Topack(round(clamp(v ,-1.0f, 1.0f) * 32767.0f));
 | 
			
		||||
		return reinterpret_cast<uint32&>(Topack);
 | 
			
		||||
		// return reinterpret_cast<uint32&>(Topack);
 | 
			
		||||
    uint* ptr(reinterpret_cast<uint*>(&Topack));
 | 
			
		||||
    return *ptr;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	GLM_FUNC_QUALIFIER vec2 unpackSnorm2x16(uint const & p)
 | 
			
		||||
@ -100,7 +104,9 @@ namespace glm
 | 
			
		||||
			detail::toFloat16(v.x),
 | 
			
		||||
			detail::toFloat16(v.y));
 | 
			
		||||
 | 
			
		||||
		return *reinterpret_cast<uint*>(&Unpack);
 | 
			
		||||
		//return *reinterpret_cast<uint*>(&Unpack);
 | 
			
		||||
    uint* ptr(reinterpret_cast<uint*>(&Unpack));
 | 
			
		||||
    return *ptr;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	GLM_FUNC_QUALIFIER vec2 unpackHalf2x16(uint const & v)
 | 
			
		||||
 | 
			
		||||
@ -551,7 +551,7 @@ namespace glm
 | 
			
		||||
		assert(ToBit <= sizeof(genIUType) * std::size_t(8));
 | 
			
		||||
 | 
			
		||||
		genIUType Result = Value;
 | 
			
		||||
		for(std::size_t i = 0; i <= ToBit; ++i)
 | 
			
		||||
		for(signed i = 0; i <= ToBit; ++i)
 | 
			
		||||
			Result |= (1 << i);
 | 
			
		||||
		return Result;
 | 
			
		||||
	}
 | 
			
		||||
@ -568,7 +568,7 @@ namespace glm
 | 
			
		||||
		assert(ToBit <= sizeof(genIUType) * std::size_t(8));
 | 
			
		||||
 | 
			
		||||
		genIUType Result = Value;
 | 
			
		||||
		for(std::size_t i = 0; i <= ToBit; ++i)
 | 
			
		||||
		for(signed i = 0; i <= ToBit; ++i)
 | 
			
		||||
			Result &= ~(1 << i);
 | 
			
		||||
		return Result;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user