Collapse the table of content
Expand the table of content
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. ArchiveDisclaimer


Microsoft Specific

Returns the high 64 bits of the product of two 64-bit signed integers.

__int64 __mulh( 
   __int64 a, 
   __int64 b 


[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



Header file <intrin.h>

This routine is only available as an intrinsic.

// mulh.cpp
// processor: x64
#include <stdio.h>
#include <intrin.h>

#pragma intrinsic (__mulh)

int main()
    __int64 a = 0x0fffffffffffffffI64;
    __int64 b = 0xf0000000I64;

    __int64 result = __mulh(a, b); // the high 64 bits
    __int64 result2 = a * b; // the low 64 bits

    printf_s(" %#I64x * %#I64x = %#I64x%I64x\n",
             a, b, result, result2);


 0xfffffffffffffff * 0xf0000000 = 0xeffffffffffffff10000000
© 2015 Microsoft