_div128

The _div128 intrinsic divides a 128-bit integer by a 64-bit integer. The return value holds the quotient, and the intrinsic returns the remainder through a pointer parameter. _div128 is Microsoft-specific.

Syntax

__int64 _div128(
   __int64 highDividend,
   __int64 lowDividend,
   __int64 divisor,
   __int64 *remainder
);

Parameters

highDividend
[in] The high 64 bits of the dividend.

lowDividend
[in] The low 64 bits of the dividend.

divisor
[in] The 64-bit integer to divide by.

remainder
[out] The 64-bit integer bits of the remainder.

Return value

The 64 bits of the quotient.

Remarks

Pass the upper 64 bits of the 128-bit dividend in highDividend, and the lower 64 bits in lowDividend. The intrinsic divides this value by divisor. It stores the remainder in the 64-bit integer pointed to by remainder, and returns the 64 bits of the quotient.

The _div128 intrinsic is available starting in Visual Studio 2019 RTM.

Requirements

Intrinsic Architecture Header
_div128 x64 <immintrin.h>

See also

_udiv128
Compiler intrinsics