ref: 84f6061a92d92f6f0136f7d6ab42fa03c38d5a78
dir: /sys/src/cmd/unix/drawterm/libmp/mpmod.c/
#include "os.h"
#include <mp.h>
#include "dat.h"
// remainder = b mod m
//
// knuth, vol 2, pp 398-400
void
mpmod(mpint *b, mpint *m, mpint *remainder)
{
mpdiv(b, m, nil, remainder);
if(remainder->sign < 0)
mpadd(m, remainder, remainder);
}