llMulDiv function

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 Int64x32Div32(
   LONGLONG a,
   LONGLONG b,
   LONGLONG c,
   LONGLONG rnd
);

Parameters

a

Multiplicand.

b

Multiplier.

c

Divisor.

rnd

Rounding factor.

Return value

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

Return codeDescription
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.

Requirements

Header

Wxutil.h (include Streams.h)

Library

Strmbase.lib (retail builds);
Strmbasd.lib (debug builds)

See also

Miscellaneous Helper Functions
Int64x32Div32

 

 

Show: