integer.hpp 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. #ifndef GLM_ENABLE_EXPERIMENTAL
  17. # error "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."
  18. #endif
  19. #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
  20. # pragma message("GLM: GLM_GTX_integer extension included")
  21. #endif
  22. namespace glm
  23. {
  24. /// @addtogroup gtx_integer
  25. /// @{
  26. //! Returns x raised to the y power.
  27. //! From GLM_GTX_integer extension.
  28. GLM_FUNC_DECL int pow(int x, uint y);
  29. //! Returns the positive square root of x.
  30. //! From GLM_GTX_integer extension.
  31. GLM_FUNC_DECL int sqrt(int x);
  32. //! Returns the floor log2 of x.
  33. //! From GLM_GTX_integer extension.
  34. GLM_FUNC_DECL unsigned int floor_log2(unsigned int x);
  35. //! Modulus. Returns x - y * floor(x / y) for each component in x using the floating point value y.
  36. //! From GLM_GTX_integer extension.
  37. GLM_FUNC_DECL int mod(int x, int y);
  38. //! Return the factorial value of a number (!12 max, integer only)
  39. //! From GLM_GTX_integer extension.
  40. template<typename genType>
  41. GLM_FUNC_DECL genType factorial(genType const& x);
  42. //! 32bit signed integer.
  43. //! From GLM_GTX_integer extension.
  44. typedef signed int sint;
  45. //! Returns x raised to the y power.
  46. //! From GLM_GTX_integer extension.
  47. GLM_FUNC_DECL uint pow(uint x, uint y);
  48. //! Returns the positive square root of x.
  49. //! From GLM_GTX_integer extension.
  50. GLM_FUNC_DECL uint sqrt(uint x);
  51. //! Modulus. Returns x - y * floor(x / y) for each component in x using the floating point value y.
  52. //! From GLM_GTX_integer extension.
  53. GLM_FUNC_DECL uint mod(uint x, uint y);
  54. //! Returns the number of leading zeros.
  55. //! From GLM_GTX_integer extension.
  56. GLM_FUNC_DECL uint nlz(uint x);
  57. /// @}
  58. }//namespace glm
  59. #include "integer.inl"