Condividi tramite


_mm_minpos_epu16

Microsoft Specific

Emits the Streaming SIMD Extensions 4 (SSE4) instruction phminposuw. This instruction selects the minimum from a set.

__m128i _mm_minpos_epu16( 
   __m128i a
);

Parameters

  • [in] a
    A 128-bit parameter that contains eight 16-bit unsigned integers.

Result value

A 128-bit value. The lowest order 16 bits are the minimum value found in parameter a. The second-lowest order 16 bits are the index of the minimum value found in parameter a.

Requirements

Intrinsic

Architecture

_mm_minpos_epu16

x86, x64

Header file <smmintrin.h>

Remarks

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;

    a.m128i_u16[0] = 127;
    a.m128i_u16[1] = 10000;
    a.m128i_u16[2] = 65535;
    a.m128i_u16[3] = 1;
    a.m128i_u16[4] = 2;
    a.m128i_u16[5] = 64;
    a.m128i_u16[6] = 314;
    a.m128i_u16[7] = 27;

    __m128i res = _mm_minpos_epu16(a);

    printf_s("Result res:\t%d\t%d\t%d\t%d\n\t\t%d\t%d\t%d\t%d\n",
                res.m128i_u16[0], res.m128i_u16[1], res.m128i_u16[2],
                res.m128i_u16[3], res.m128i_u16[4], res.m128i_u16[5],
                res.m128i_u16[6], res.m128i_u16[7]);

    return 0;
}

Result res:     1       3       0       0
                0       0       0       0

See Also

Concepts

Compiler Intrinsics