summaryrefslogtreecommitdiff
path: root/plugins/gme/game-music-emu-0.6pre/gme/divfix.h
blob: 21212df3f427129139390ca012ab3d7b75ca6453 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

static Uint32 DivFix(Uint32 p1, Uint32 p2, Uint32 fix)
{
	Uint32 ret;
	ret = p1 / p2;
	p1  = p1 % p2;/* p1 = p1 - p2 * ret; */
	while (fix--)
	{
		p1 += p1;
		ret += ret;
		if (p1 >= p2)
		{
			p1 -= p2;
			ret++;
		}
	}
	return ret;
}