Sha256: fde5ef132a948e0022973ed23c10c397f10fd76287d7a6d599bfe7943d1d23be

Contents?: true

Size: 1.6 KB

Versions: 21

Compression:

Stored size: 1.6 KB

Contents

/// @ref core
/// @file glm/detail/func_integer_simd.inl

#include "../simd/integer.h"

#if GLM_ARCH & GLM_ARCH_SSE2_BIT

namespace glm{
namespace detail
{
	template <glm::precision P>
	struct compute_bitfieldReverseStep<uint32, P, tvec4, true, true>
	{
		GLM_FUNC_QUALIFIER static tvec4<uint32, P> call(tvec4<uint32, P> const & v, uint32 Mask, uint32 Shift)
		{
			__m128i const set0 = v.data;

			__m128i const set1 = _mm_set1_epi32(Mask);
			__m128i const and1 = _mm_and_si128(set0, set1);
			__m128i const sft1 = _mm_slli_epi32(and1, Shift);

			__m128i const set2 = _mm_andnot_si128(set0, _mm_set1_epi32(-1));
			__m128i const and2 = _mm_and_si128(set0, set2);
			__m128i const sft2 = _mm_srai_epi32(and2, Shift);
		
			__m128i const or0 = _mm_or_si128(sft1, sft2);
		
			return or0;
		}
	};

	template <glm::precision P>
	struct compute_bitfieldBitCountStep<uint32, P, tvec4, true, true>
	{
		GLM_FUNC_QUALIFIER static tvec4<uint32, P> call(tvec4<uint32, P> const & v, uint32 Mask, uint32 Shift)
		{
			__m128i const set0 = v.data;

			__m128i const set1 = _mm_set1_epi32(Mask);
			__m128i const and0 = _mm_and_si128(set0, set1);
			__m128i const sft0 = _mm_slli_epi32(set0, Shift);
			__m128i const and1 = _mm_and_si128(sft0, set1);
			__m128i const add0 = _mm_add_epi32(and0, and1);
		
			return add0;
		}
	};
}//namespace detail

#	if GLM_ARCH & GLM_ARCH_AVX_BIT
	template <>
	GLM_FUNC_QUALIFIER int bitCount(uint32 x)
	{
		return _mm_popcnt_u32(x);
	}

	template <>
	GLM_FUNC_QUALIFIER int bitCount(uint64 x)
	{
		return static_cast<int>(_mm_popcnt_u64(x));
	}
#	endif

}//namespace glm

#endif//GLM_ARCH & GLM_ARCH_SSE2_BIT

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
pixo-0.4.5 ext/pixo/ext/glm/glm/detail/func_integer_simd.inl
pixo-0.4.4 ext/pixo/ext/glm/glm/detail/func_integer_simd.inl
pixo-0.4.3 ext/pixo/ext/glm/glm/detail/func_integer_simd.inl
pixo-0.4.2 ext/pixo/ext/glm/glm/detail/func_integer_simd.inl
pixo-0.4.1 ext/pixo/ext/glm/glm/detail/func_integer_simd.inl
pixo-0.4.0 ext/pixo/ext/glm/glm/detail/func_integer_simd.inl
pixo-0.3.2 ext/pixo/ext/glm/glm/detail/func_integer_simd.inl
pixo-0.3.1 ext/pixo/ext/glm/glm/detail/func_integer_simd.inl
pixo-0.3.0 ext/pixo/ext/glm/glm/detail/func_integer_simd.inl
pixo-0.2.6 ext/pixo/ext/glm/glm/detail/func_integer_simd.inl
pixo-0.2.5 ext/pixo/ext/glm/glm/detail/func_integer_simd.inl
pixo-0.2.4 ext/pixo/ext/glm/glm/detail/func_integer_simd.inl
pixo-0.2.3 ext/pixo/ext/glm/glm/detail/func_integer_simd.inl
pixo-0.2.2 ext/pixo/ext/glm/glm/detail/func_integer_simd.inl
pixo-0.2.1 ext/pixo/ext/glm/glm/detail/func_integer_simd.inl
pixo-0.2.0 ext/pixo/ext/glm/glm/detail/func_integer_simd.inl
pixo-0.1.4 ext/pixo/ext/glm/glm/detail/func_integer_simd.inl
pixo-0.1.3 ext/pixo/ext/glm/glm/detail/func_integer_simd.inl
pixo-0.1.2 ext/pixo/ext/glm/glm/detail/func_integer_simd.inl
pixo-0.1.1 ext/pixo/ext/glm/glm/detail/func_integer_simd.inl