summaryrefslogtreecommitdiff
path: root/plugins/gme/game-music-emu-0.6pre/gme/divfix.h
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/gme/game-music-emu-0.6pre/gme/divfix.h')
-rw-r--r--plugins/gme/game-music-emu-0.6pre/gme/divfix.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/plugins/gme/game-music-emu-0.6pre/gme/divfix.h b/plugins/gme/game-music-emu-0.6pre/gme/divfix.h
new file mode 100644
index 00000000..21212df3
--- /dev/null
+++ b/plugins/gme/game-music-emu-0.6pre/gme/divfix.h
@@ -0,0 +1,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;
+}