| title | __emul, __emulu | Microsoft Docs | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| ms.custom | ||||||||||
| ms.date | 11/04/2016 | |||||||||
| ms.reviewer | ||||||||||
| ms.suite | ||||||||||
| ms.technology |
|
|||||||||
| ms.tgt_pltfrm | ||||||||||
| ms.topic | article | |||||||||
| f1_keywords |
|
|||||||||
| dev_langs |
|
|||||||||
| helpviewer_keywords |
|
|||||||||
| ms.assetid | 79545236-cca2-40b8-a4e1-8abce9b26311 | |||||||||
| caps.latest.revision | 10 | |||||||||
| author | corob-msft | |||||||||
| ms.author | corob | |||||||||
| manager | ghogen | |||||||||
| translation.priority.ht |
|
|||||||||
| translation.priority.mt |
|
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, [!INCLUDEvcprx64] |
__emulu |
x86, [!INCLUDEvcprx64] |
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
END Microsoft Specific