Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

__UMULH, __umulh

Microsoft Specific

Return the high 64 bits of the product of two 64-bit unsigned integers.


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

Parameters

[in] a

The first number to multiply.

[in] b

The second number to multiply.

The high 64 bits of the 128-bit result of the multiplication.

Intrinsic Architecture

__UMULH

IPF

__umulh

x64

Header file <intrin.h>

These routines are only available as intrinsics.

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

#pragma intrinsic (__UMULH)

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%I64x * 0x%I64x = 0x%I64x%I64x \n", i, j, result, k);
    return 0;
}

Output

0x10 * 0xfedcba9876543210 = 0xfedcba98765432100 

Community Additions

ADD
Show:
© 2015 Microsoft