integer.hpp 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. /// Include <glm/gtx/integer.hpp> to use the features of this extension.
  10. ///
  11. /// Add support for integer for core functions
  12. #pragma once
  13. // Dependency:
  14. #include "../glm.hpp"
  15. #include "../gtc/integer.hpp"
  16. #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
  17. # ifndef GLM_ENABLE_EXPERIMENTAL
  18. # pragma message("GLM: GLM_GTX_integer is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it.")
  19. # else
  20. # pragma message("GLM: GLM_GTX_integer extension included")
  21. # endif
  22. #endif
  23. namespace glm
  24. {
  25. /// @addtogroup gtx_integer
  26. /// @{
  27. //! Returns x raised to the y power.
  28. //! From GLM_GTX_integer extension.
  29. GLM_FUNC_DECL int pow(int x, uint y);
  30. //! Returns the positive square root of x.
  31. //! From GLM_GTX_integer extension.
  32. GLM_FUNC_DECL int sqrt(int x);
  33. //! Returns the floor log2 of x.
  34. //! From GLM_GTX_integer extension.
  35. GLM_FUNC_DECL unsigned int floor_log2(unsigned int x);
  36. //! Modulus. Returns x - y * floor(x / y) for each component in x using the floating point value y.
  37. //! From GLM_GTX_integer extension.
  38. GLM_FUNC_DECL int mod(int x, int y);
  39. //! Return the factorial value of a number (!12 max, integer only)
  40. //! From GLM_GTX_integer extension.
  41. template<typename genType>
  42. GLM_FUNC_DECL genType factorial(genType const& x);
  43. //! 32bit signed integer.
  44. //! From GLM_GTX_integer extension.
  45. typedef signed int sint;
  46. //! Returns x raised to the y power.
  47. //! From GLM_GTX_integer extension.
  48. GLM_FUNC_DECL uint pow(uint x, uint y);
  49. //! Returns the positive square root of x.
  50. //! From GLM_GTX_integer extension.
  51. GLM_FUNC_DECL uint sqrt(uint x);
  52. //! Modulus. Returns x - y * floor(x / y) for each component in x using the floating point value y.
  53. //! From GLM_GTX_integer extension.
  54. GLM_FUNC_DECL uint mod(uint x, uint y);
  55. //! Returns the number of leading zeros.
  56. //! From GLM_GTX_integer extension.
  57. GLM_FUNC_DECL uint nlz(uint x);
  58. /// @}
  59. }//namespace glm
  60. #include "integer.inl"