__m64_extr, __m64_extru

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

Parameters

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

Requirements

Intrinsic

Architecture

__m64_extr

IPF

__m64_extru

IPF

Header file <intrin.h>

Remarks

__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.

Example

// 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;
}
0xffffffffffffff88
0x88

See Also

Reference

__m64

Compiler Intrinsics