¿Le resultó útil esta página?
Sus comentarios sobre este contenido son muy importantes. Háganos saber su opinión.
¿Tiene comentarios adicionales?
Caracteres restantes: 1500
Exportar (0) Imprimir
Expandir todo
Expandir Minimizar


Microsoft Specific

Emits the Supplemental Streaming SIMD Extensions 3 (SSSE3) instruction phsubw. This instruction computes the difference between the elements of two 64-bit parameters.

__m64 _mm_hsub_pi16( 
   __m64 a,
   __m64 b

[in] a

A 64-bit parameter that contains four 16-bit signed integers.

[in] b

A 64-bit parameter that contains four 16-bit signed integers.

A 64-bit parameter that contains four 16-bit signed integers. Each integer is the difference between adjacent pairs of elements in the input parameters.

The result can be expressed with the following equations:

r0 := a0 - a1
r1 := a2 - a3
r2 := b0 - b1
r3 := b2 - b3




x86, x64

Header file <tmmintrin.h>

r0-r3, a0-a3, and b0-b3 are the sequentially ordered 16-bit components of return value r and parameters a and b. r0, a0, and b0 denote the least significant 16 bits.

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

#include <stdio.h>
#include <tmmintrin.h>

int main ()
    __m64 a, b;

    a.m64_i16[0] = 32;
    a.m64_i16[1] = 32;
    a.m64_i16[2] = 4096;
    a.m64_i16[3] = -4096;
    b.m64_i16[0] = 16700;
    b.m64_i16[1] = 32000;
    b.m64_i16[2] = -16;
    b.m64_i16[3] = 512;

    __m64 res = _mm_hsub_pi16(a, b);

    printf_s("Original a:\t%6d\t%6d\t%6d\t%6d\nOriginal b:\t%6d\t%6d\t%6d\t%6d\n",
                a.m64_i16[0], a.m64_i16[1], a.m64_i16[2], a.m64_i16[3],
                b.m64_i16[0], b.m64_i16[1], b.m64_i16[2], b.m64_i16[3]);
    printf_s("Result res:\t%6d\t%6d\t%6d\t%6d\n",
                res.m64_i16[0], res.m64_i16[1], res.m64_i16[2], res.m64_i16[3]);


    return 0;
Original a:         32      32    4096   -4096
Original b:      16700   32000     -16     512
Result res:          0    8192  -15300    -528

Adiciones de comunidad

© 2015 Microsoft