scalar_integer.hpp 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /// @ref ext_scalar_integer
  2. /// @file glm/ext/scalar_integer.hpp
  3. ///
  4. /// @see core (dependence)
  5. ///
  6. /// @defgroup ext_scalar_integer GLM_EXT_scalar_integer
  7. /// @ingroup ext
  8. ///
  9. /// Include <glm/ext/scalar_integer.hpp> to use the features of this extension.
  10. #pragma once
  11. // Dependencies
  12. #include "../detail/setup.hpp"
  13. #include "../detail/qualifier.hpp"
  14. #include "../detail/_vectorize.hpp"
  15. #include "../detail/type_float.hpp"
  16. #include "../vector_relational.hpp"
  17. #include "../common.hpp"
  18. #include <limits>
  19. #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
  20. # pragma message("GLM: GLM_EXT_scalar_integer extension included")
  21. #endif
  22. namespace glm
  23. {
  24. /// @addtogroup ext_scalar_integer
  25. /// @{
  26. /// Return true if the value is a power of two number.
  27. ///
  28. /// @see ext_scalar_integer
  29. template<typename genIUType>
  30. GLM_FUNC_DECL bool isPowerOfTwo(genIUType v);
  31. /// Return the power of two number which value is just higher the input value,
  32. /// round up to a power of two.
  33. ///
  34. /// @see ext_scalar_integer
  35. template<typename genIUType>
  36. GLM_FUNC_DECL genIUType nextPowerOfTwo(genIUType v);
  37. /// Return the power of two number which value is just lower the input value,
  38. /// round down to a power of two.
  39. ///
  40. /// @see ext_scalar_integer
  41. template<typename genIUType>
  42. GLM_FUNC_DECL genIUType prevPowerOfTwo(genIUType v);
  43. /// Return true if the 'Value' is a multiple of 'Multiple'.
  44. ///
  45. /// @see ext_scalar_integer
  46. template<typename genIUType>
  47. GLM_FUNC_DECL bool isMultiple(genIUType v, genIUType Multiple);
  48. /// Higher multiple number of Source.
  49. ///
  50. /// @tparam genIUType Integer scalar or vector types.
  51. ///
  52. /// @param v Source value to which is applied the function
  53. /// @param Multiple Must be a null or positive value
  54. ///
  55. /// @see ext_scalar_integer
  56. template<typename genIUType>
  57. GLM_FUNC_DECL genIUType nextMultiple(genIUType v, genIUType Multiple);
  58. /// Lower multiple number of Source.
  59. ///
  60. /// @tparam genIUType Integer scalar or vector types.
  61. ///
  62. /// @param v Source value to which is applied the function
  63. /// @param Multiple Must be a null or positive value
  64. ///
  65. /// @see ext_scalar_integer
  66. template<typename genIUType>
  67. GLM_FUNC_DECL genIUType prevMultiple(genIUType v, genIUType Multiple);
  68. /// Returns the bit number of the Nth significant bit set to
  69. /// 1 in the binary representation of value.
  70. /// If value bitcount is less than the Nth significant bit, -1 will be returned.
  71. ///
  72. /// @tparam genIUType Signed or unsigned integer scalar types.
  73. ///
  74. /// @see ext_scalar_integer
  75. template<typename genIUType>
  76. GLM_FUNC_DECL int findNSB(genIUType x, int significantBitCount);
  77. /// @}
  78. } //namespace glm
  79. #include "scalar_integer.inl"