From dd48a759d7e698a4b8d9c68e1aa34e5db4792e50 Mon Sep 17 00:00:00 2001 From: Lukas Werling Date: Sun, 1 May 2016 19:25:12 +0200 Subject: [PATCH] Add mathematical modulo helper function Mod(a, b) --- planet/System.ocg/Math.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/planet/System.ocg/Math.c b/planet/System.ocg/Math.c index 69b01d0f5..c98bea06e 100644 --- a/planet/System.ocg/Math.c +++ b/planet/System.ocg/Math.c @@ -160,4 +160,10 @@ global func GetSurfaceVector(int x, int y) } return normal; -} \ No newline at end of file +} + +// Proper modulo operation. +global func Mod(a, b) +{ + return (a % b + b) % b; +}