¿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

__emul, __emulu

Microsoft Specific

Performs multiplications that overflow what a 32-bit integer can hold.

__int64 __emul(
   int a,
   int b
);
unsigned __int64 __emulu(
   unsigned int a,
   unsigned int b
);

[in] a

The first integer operand of the multiplication.

[in] b

The second integer operand of the multiplication.

The result of the multiplication.

Intrinsic

Architecture

__emul

x86, x64

__emulu

x86, x64

Header file <intrin.h>

__emul takes two 32-bit signed values and returns the result of the multiplication as a 64-bit signed integer value.

__emulu takes two 32-bit unsigned integer values and returns the result of the multiplication as a 64-bit unsigned integer value.

// emul.cpp
// compile with: /EHsc
// processor: x86, x64
#include <iostream>
#include <intrin.h>
using namespace std;

#pragma intrinsic(__emul)
#pragma intrinsic(__emulu)

int main()
{
   int a = -268435456; 
   int b = 2; 

   __int64 result = __emul(a, b);

   cout << a << " * " << b << " = " << result << endl;

   unsigned int ua = 0xFFFFFFFF; // Dec value: 4294967295
   unsigned int ub = 0xF000000;  // Dec value: 251658240

   unsigned __int64 uresult = __emulu(ua, ub);

   cout << ua << " * " << ub << " = " << uresult << endl;

}

-268435456 * 2 = -536870912
4294967295 * 251658240 = 1080863910317260800

Adiciones de comunidad

AGREGAR
Mostrar:
© 2015 Microsoft