_mm_cvtsi64_ss
Visual Studio 2010
Microsoft Specific
Emits the Streaming SIMD Extensions (SSE) instruction cvtsi2ss. This instruction converts a 64-bit signed integer to a single-precision floating point number and inserts it into another 128 bit parameter.
__m128 _mm_cvtsi64_ss( __m128 a, __int64 b );
r0-r3 and a0-a3 are are the sequentially ordered 32-bit components of return value r and parameter a, respectively. r0 and a0 are the least significant 32 bits.
The upper 96 bits of parameter a are passed to the result unchanged.
Before you use this intrinsic, software must ensure that the processor supports the instruction.
#include <stdio.h>
#include <xmmintrin.h>
int main ()
{
__m128 a;
__int64 b = -65535;
a.m128_f32[0] = 1.5;
a.m128_f32[1] = -3.25;
a.m128_f32[2] = 3.0625;
a.m128_f32[3] = -50.125;
__m128 res = _mm_cvtsi64_ss(a, b);
printf_s("Original a: %f\t%f\t%f\t%f\nOriginal b: %I64d\n",
a.m128_f32[3], a.m128_f32[2], a.m128_f32[1], a.m128_f32[0], b);
printf_s("Result res: %f\t%f\t%f\t%f\n",
res.m128_f32[3], res.m128_f32[2], res.m128_f32[1], res.m128_f32[0]);
return 0;
}
Original a: -50.125000 3.062500 -3.250000 1.500000 Original b: -65535 Result res: -50.125000 3.062500 -3.250000 -65535.000000