From: Patrik Gornicz Date: Wed, 19 Aug 2009 03:44:34 +0000 (-0400) Subject: change mod to use unsigned ints X-Git-Tag: libbear-premerge~21 X-Git-Url: http://gitweb.pgornicz.com/?a=commitdiff_plain;h=69b1022f053087cbc50ca83ba69b09dd9339e1b3;p=libbear.git change mod to use unsigned ints --- 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