01-16-2014, 05:53 AM
This function
turned into this monster
float cNoise::IntNoise( int a_X ) { int x = ((a_X*m_Seed)<<13) ^ a_X; return ( 1.0f - ( (x * (x * x * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0f); }
turned into this monster
__m128 SSE_IntNoise( const __m128i & a_X4 ) { __m128i X4 = _mm_xor_si128( _mm_slli_epi32( a_X4, 13 ), a_X4 ); //_mm_sub_ps( _mm_set_ps1( 1.0f ) // 1.f - __m128 result = _mm_sub_ps( _mm_set_ps1( 1.0f ) , _mm_div_ps( // ( ( (x * ((x*x)*15731 + 789221)) + 1376312589 ) & 0x7fffffff ) / 1073741824.0f _mm_cvtepi32_ps( // (float) -> converts to float _mm_and_si128( // ( (x * ((x*x)*15731 + 789221)) + 1376312589 ) & 0x7fffffff _mm_set1_epi32( 0x7fffffff ) // 0x7fffffff , _mm_add_epi32( // (x * ((x*x)*15731 + 789221)) + 1376312589 _mm_set1_epi32( 1376312589 ) // 1376312589 , _mm_mul_epu32( // x * ((x*x)*15731 + 789221) X4 , _mm_add_epi32( // ((x*x)*15731 + 789221) _mm_set1_epi32( 789221 ) // 789221 , _mm_mul_epu32( // ((x*x)*15731) _mm_mul_epu32( X4, X4 ) // x*x , _mm_set1_epi32( 15731 ) // 15731 ) ) ) ) ) ) , _mm_set_ps1( 1073741824.0f ) // 1073741824.0f ) ); return result; }