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

__m64_extr, __m64_extru

Visual Studio 2010

Microsoft Specific

Emit the IPF Extract (extr) instruction.

__m64 __m64_extr( 
   __m64 value, 
   const int pos, 
   const int len 
__m64 __m64_extru( 
   __m64 value,
   const int pos,
   const int len 

[in] value

The variable to extract bits from.

[in] pos

The position of the first bit to extract. Valid values from 0 to 63.

[in] len

The number of bits to extract. Valid values from 1 to 64.







Header file <intrin.h>

__m64_extr emits the signed form (extr) and __m64_extru emits the unsigned form (extr.u). Both instructions extract len bits starting at bit pos (counted from the least significant bit). These bits are placed in the least significant len bits of the result. The result is sign extended in the signed form of the instruction, and zero extended in the unsigned form. The highest bit extracted determines the sign.

// extr.cpp
// processor: IPF
#include <stdio.h>
#include <intrin.h>

#pragma intrinsic(__m64_extr, __m64_extru)

int main()
    __m64 m, n;
    m.m64_i64 = 0x8800ff;

    // The signed version does a sign extension based on the MSB
    // of the extracted portion.
    n = __m64_extr(m, 16, 8);
    printf_s("0x%I64x\n", n.m64_i64);

    // The unsigned version does a zero extension.
    n = __m64_extru(m, 16, 8);
    printf_s("0x%I64x\n", n.m64_i64);
    return 1;