分享方式:


_mul128

Microsoft 特定的

將傳入為前兩個引數的兩個 64 位元整數相乘,並將乘積的 64 高位元,置於 HighProduct 所指的 64 位元整數中,並傳回乘積的 64 低位元。

語法

__int64 _mul128(
   __int64 Multiplier,
   __int64 Multiplicand,
   __int64 *HighProduct
);

參數

乘數
[in]要相乘的前 64 位整數。

乘法
[in]要相乘的第二個 64 位整數。

HighProduct
[out]產品的高 64 位。

傳回值

乘積的 64 低位元。

需求

內建 架構
_mul128 x64

標頭檔 < intrin.h>

範例

// mul128.c
// processor: x64
#include <stdio.h>
#include <intrin.h>

#pragma intrinsic(_mul128)

int main()
{
    __int64 a = 0x0fffffffffffffffI64;
    __int64 b = 0xf0000000I64;
    __int64 c, d;

    d = _mul128(a, b, &c);

    printf_s("%#I64x * %#I64x = %#I64x%I64x\n", a, b, c, d);
}
0xfffffffffffffff * 0xf0000000 = 0xeffffffffffffff10000000

END Microsoft 特定的

另請參閱

編譯器內建函式