Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic


Microsoft Specific

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

__int64 _mm_extract_epi64( 
   __m128i a,
   const int ndx 
[in] a

A 128-bit parameter that contains two 64-bit integers. These integers can be signed or unsigned.

[in] ndx

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

The return value can be expressed by the following equation:

r := (ndx == 0) ? a0 : a1





Header file <smmintrin.h>

a0 is the lower 64 bits of parameter a. a1 is the higher 64 bits of parameter a.

Only the least significant bit of parameter ndx is used.

The result is the unsigned equivalent of the appropriate 64-bits in parameter a.

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

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

int main ()
    __m128i a;
    const int ndx = 0;

    a.m128i_i64[0] = 65535;
    a.m128i_i64[1] = 248000000;

    __int64 res = _mm_extract_epi64(a, ndx);
    printf_s("Result res should equal %I64d: %I64d\n", a.m128i_i64[ndx], res);

    return 0;
Result res should equal 65535: 65535
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2014 Microsoft. All rights reserved.