summaryrefslogtreecommitdiff
path: root/src/glm/gtx/unsigned_int.inl
diff options
context:
space:
mode:
Diffstat (limited to 'src/glm/gtx/unsigned_int.inl')
-rw-r--r--src/glm/gtx/unsigned_int.inl45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/glm/gtx/unsigned_int.inl b/src/glm/gtx/unsigned_int.inl
new file mode 100644
index 0000000..21aece7
--- /dev/null
+++ b/src/glm/gtx/unsigned_int.inl
@@ -0,0 +1,45 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2005-12-24
+// Updated : 2008-10-07
+// Licence : This source is under MIT License
+// File : glm/gtx/unsigned_int.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace gtx{
+namespace unsigned_int{
+
+GLM_FUNC_QUALIFIER uint pow(uint x, uint y)
+{
+ uint result = x;
+ for(uint i = 1; i < y; ++i)
+ result *= x;
+ return result;
+}
+
+GLM_FUNC_QUALIFIER uint sqrt(uint x)
+{
+ if(x <= 1) return x;
+
+ uint NextTrial = x >> 1;
+ uint CurrentAnswer;
+
+ do
+ {
+ CurrentAnswer = NextTrial;
+ NextTrial = (NextTrial + x / NextTrial) >> 1;
+ } while(NextTrial < CurrentAnswer);
+
+ return CurrentAnswer;
+}
+
+GLM_FUNC_QUALIFIER uint mod(uint x, uint y)
+{
+ return x - y * (x / y);
+}
+
+}//namespace unsigned_int
+}//namespace gtx
+}//namespace glm