Microsoft DirectX 9.0

llMulDiv

The llMulDiv function implements the formula ((a*b)+rnd)/c where each term is a 64-bit value.

Time stamps and seek times are 64-bit values, so this function is useful for performing conversions on 32-bit systems. For example, the formula for bytes-per-second is

(Number of Bytes * Reference Time) / 10,000,000

which can be calculated as llMulDiv(nBytes, rtTime, 10000000, 0). Use the rnd parameter as a rounding factor.

Syntax

LONGLONG WINAPI llMulDiv(
  LONGLONG a,
  LONGLONG b,
  LONGLONG c,
  LONGLONG rnd
);

Return Value

Returns either the (a * b + rnd)/c calculation or one of the following values.

0x7FFFFFFFFFFFFFFF Overflow occurred because the result is too large (positive).
0x8000000000000000 Overflow occurred because the result is too large (negative).

Remarks

Rounding on the division is toward zero. Division by zero is counted as an overflow condition.

See Also