Share via


_mm_extract_epi64

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 
);

Parameters

  • [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.

Result value

The return value can be expressed by the following equation:

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

Requirements

Intrinsic

Architecture

_mm_extract_epi64

x64

Header file <smmintrin.h>

Remarks

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.

Example

#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

See Also

Reference

Compiler Intrinsics