1 /// @ref gtx_integer 2 /// @file glm/gtx/integer.hpp 3 /// 4 /// @see core (dependence) 5 /// 6 /// @defgroup gtx_integer GLM_GTX_integer 7 /// @ingroup gtx 8 /// 9 /// @brief Add support for integer for core functions 10 /// 11 /// <glm/gtx/integer.hpp> need to be included to use these functionalities. 12 13 #pragma once 14 15 // Dependency: 16 #include "../glm.hpp" 17 #include "../gtc/integer.hpp" 18 19 #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 20 # pragma message("GLM: GLM_GTX_integer extension included") 21 #endif 22 23 namespace glm 24 { 25 /// @addtogroup gtx_integer 26 /// @{ 27 28 //! Returns x raised to the y power. 29 //! From GLM_GTX_integer extension. 30 GLM_FUNC_DECL int pow(int x, int y); 31 32 //! Returns the positive square root of x. 33 //! From GLM_GTX_integer extension. 34 GLM_FUNC_DECL int sqrt(int x); 35 36 //! Returns the floor log2 of x. 37 //! From GLM_GTX_integer extension. 38 GLM_FUNC_DECL unsigned int floor_log2(unsigned int x); 39 40 //! Modulus. Returns x - y * floor(x / y) for each component in x using the floating point value y. 41 //! From GLM_GTX_integer extension. 42 GLM_FUNC_DECL int mod(int x, int y); 43 44 //! Return the factorial value of a number (!12 max, integer only) 45 //! From GLM_GTX_integer extension. 46 template <typename genType> 47 GLM_FUNC_DECL genType factorial(genType const & x); 48 49 //! 32bit signed integer. 50 //! From GLM_GTX_integer extension. 51 typedef signed int sint; 52 53 //! Returns x raised to the y power. 54 //! From GLM_GTX_integer extension. 55 GLM_FUNC_DECL uint pow(uint x, uint y); 56 57 //! Returns the positive square root of x. 58 //! From GLM_GTX_integer extension. 59 GLM_FUNC_DECL uint sqrt(uint x); 60 61 //! Modulus. Returns x - y * floor(x / y) for each component in x using the floating point value y. 62 //! From GLM_GTX_integer extension. 63 GLM_FUNC_DECL uint mod(uint x, uint y); 64 65 //! Returns the number of leading zeros. 66 //! From GLM_GTX_integer extension. 67 GLM_FUNC_DECL uint nlz(uint x); 68 69 /// @} 70 }//namespace glm 71 72 #include "integer.inl" 73