分享方式:


__umulh

Microsoft 特定的

傳回兩個 64 位元不帶正負號整數之乘積的 64 高位元。

語法

unsigned __int64 __umulh(
   unsigned __int64 a,
   unsigned __int64 b
);

參數

a
[in] 要相乘的第一個數字。

b
[in] 要相乘的第二個數字。

傳回值

相乘的 128 位元結果的 64 高位元。

需求

內建 架構
__umulh x64、ARM64

標頭檔 < intrin.h>

備註

這些常式僅以內建函式的形式供您使用。

範例

// umulh.cpp
// processor: X64
#include <cstdio>
#include <intrin.h>

int main()
{
    unsigned __int64 i = 0x10;
    unsigned __int64 j = 0xFEDCBA9876543210;
    unsigned __int64 k = i * j; // k has the low 64 bits
                                // of the product.
    unsigned __int64 result;
    result = __umulh(i, j); // result has the high 64 bits
                            // of the product.
    printf_s("0x%016I64x * 0x%016I64x = 0x%016I64x_%016I64x \n", i, j, result, k);
    return 0;
}
0x0000000000000010 * 0xfedcba9876543210 = 0x000000000000000f_edcba98765432100

END Microsoft 特定的

另請參閱

編譯器內建函式