Esta documentación está archivada y no tiene mantenimiento.


Microsoft Specific

Emits the Streaming SIMD Extensions 4 (SSE4) instruction extractps. This instruction extracts a 32 bit integer from a 128-bit parameter.

int _mm_extract_ps( 
   __m128 a,
   const int ndx 

[in] a

A 128-bit parameter that contains four 32-bit floating point values.

[in] ndx

A constant index that specifies the location of the value to extract.

The return value can be expressed by the following equations:

r := (ndx == 0) ? a0 :
  ((ndx == 1) ? a1 :
  ((ndx == 2) ? a2 : a3))




x86, x64

Header file <smmintrin.h>

a0-a3 are the individual 32-bit floating point values in parameter a, with a0 occupying the lowest 32 bits.

Only the least significant two bits of ndx are used.

Before you use this intrinsic, software must ensure that the processor supports the instruction.

#include <stdio.h>
#include <smmintrin.h>

int main ()
    __m128 a;
    const int ndx = 1;

    a.m128_f32[0] = 1.25;
    a.m128_f32[1] = -5.125;
    a.m128_f32[2] = 16.0;
    a.m128_f32[3] = 3.5;

    int res = _mm_extract_ps(a, ndx);
    // Note: These are printed out in hex format to easily identify that the float and corresponding
    //       integer value are identical
    printf_s("Result res should equal %x: %x\n", a.m128_u32[ndx], res);

    return 0;
Result res should equal c0a40000: c0a40000