NAME
muldiv, umuldiv – high–precision multiplication and division

SYNOPSIS
#include <u.h>
#include <libc.h>

long muldiv(long a, long b, long c)

ulong umuldiv(ulong a, ulong b, ulong c)

DESCRIPTION
Muldiv returns a*b/c, using a vlong to hold the intermediate result. Umuldiv is the equivalent for unsigned integers. They can be used to scale integer values without worry about overflowing the intermediate result.

On some architectures, these routines can generate a trap if the final result does not fit in a long or ulong; on others they will silently truncate.