DWORD dwGroupCount = dwCount / 4; __m128 e_Scale = _mm_set_ps1( fScale ); for ( DWORD i = 0; i < dwGroupCount; i++ ) { *(__m128*)( pArray + i * 4 ) = _mm_mul_ps( *(__m128*)( pArray + i * 4 ), e_Scale ); } } void ScaleValue2( float *pArray, DWORD dwCount, float fScale ) { for ( DWORD i = 0; i < dwCount; i++ ) { pArray[i] *= fScale; } } #define ARRAYCOUNT 10000 int __cdecl main() { float __declspec(align(16)) Array[ARRAYCOUNT]; memset( Array, 0, sizeof(float) * ARRAYCOUNT ); CTimer t; double dTime; t.Reset(); |