utilUint64Scale

fnulong utilUint64Scale(ulong val, ulong num, ulong denom)

Scale val by the rational number num / denom, avoiding overflows and underflows and without loss of precision.

This function can potentially be very slow if val and num are both greater than G_MAXUINT32.

Parameters

valthe number to scale
numthe numerator of the scale ratio
denomthe denominator of the scale ratio

Returns

val * num / denom. In the case of an overflow, this

function returns G_MAXUINT64. If the result is not exactly representable as an integer it is truncated. See also gst.global.utilUint64ScaleRound, gst.global.utilUint64ScaleCeil, gst.global.utilUint64ScaleInt, gst.global.utilUint64ScaleIntRound, gst.global.utilUint64ScaleIntCeil.