Int64x32Div32 function
[The feature associated with this page, DirectShow, is a legacy feature. It has been superseded by MediaPlayer, IMFMediaEngine, and Audio/Video Capture in Media Foundation. Those features have been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer, IMFMediaEngine and Audio/Video Capture in Media Foundation instead of DirectShow, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]
The Int64x32Div32
function implements the formula ((a*b)+rnd)/c
where a is a 64-bit value and b, c, and rnd are 32-bit values.
Syntax
LONGLONG WINAPI Int64x32Div32(
LONGLONG a,
LONG b,
LONG c,
LONG 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 code | Description |
---|---|
|
Overflow occurred because the result is too large (positive). |
|
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.
Time stamps and seek times are 64-bit values, so this function is useful for performing conversions on 32-bit systems. For example, in MPEG-1 the system clock reference is 90-kHz, or 90,000 ticks per second. The formula to convert this to reference time (100-nanosecond units) is
(timestamp * 1000) / 9
which can be calculated as Int64x32Div32(timestamp, 1000, 9, 0)
. Use the rnd parameter as a rounding factor.
Requirements
Requirement | Value |
---|---|
Header |
|
Library |
|
See also