From 69b1022f053087cbc50ca83ba69b09dd9339e1b3 Mon Sep 17 00:00:00 2001 From: Patrik Gornicz Date: Tue, 18 Aug 2009 23:44:34 -0400 Subject: [PATCH] change mod to use unsigned ints --- lib/include/bear/mathw.h | 2 +- lib/src/mathw.cpp | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/include/bear/mathw.h b/lib/include/bear/mathw.h index 07f5769..de9538f 100644 --- a/lib/include/bear/mathw.h +++ b/lib/include/bear/mathw.h @@ -30,7 +30,7 @@ namespace bear /// ***** Header Methods ***** - int mod(int, int); + unsigned int mod(unsigned int, unsigned int); /// Vector2 Math diff --git a/lib/src/mathw.cpp b/lib/src/mathw.cpp index 35d866b..db4fafb 100644 --- a/lib/src/mathw.cpp +++ b/lib/src/mathw.cpp @@ -27,11 +27,12 @@ using namespace bear; /// ***** Public Methods ***** -int bear::mod(int x, int y) +unsigned int bear::mod(unsigned int x, unsigned int y) { - return x % y + (x < 0 ? y : 0); + return x % y; } + // Vector2 Math Vector2 bear::vectorToLine -- 2.10.2