bit.hpp 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /// @ref gtx_bit
  2. /// @file glm/gtx/bit.hpp
  3. ///
  4. /// @see core (dependence)
  5. ///
  6. /// @defgroup gtx_bit GLM_GTX_bit
  7. /// @ingroup gtx
  8. ///
  9. /// Include <glm/gtx/bit.hpp> to use the features of this extension.
  10. ///
  11. /// Allow to perform bit operations on integer values
  12. #pragma once
  13. // Dependencies
  14. #include "../gtc/bitfield.hpp"
  15. #ifndef GLM_ENABLE_EXPERIMENTAL
  16. # error "GLM: GLM_GTX_bit 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."
  17. #elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
  18. # pragma message("GLM: GLM_GTX_bit extension included")
  19. #endif
  20. namespace glm
  21. {
  22. /// @addtogroup gtx_bit
  23. /// @{
  24. /// @see gtx_bit
  25. template<typename genIUType>
  26. GLM_FUNC_DECL genIUType highestBitValue(genIUType Value);
  27. /// @see gtx_bit
  28. template<typename genIUType>
  29. GLM_FUNC_DECL genIUType lowestBitValue(genIUType Value);
  30. /// Find the highest bit set to 1 in a integer variable and return its value.
  31. ///
  32. /// @see gtx_bit
  33. template<length_t L, typename T, qualifier Q>
  34. GLM_FUNC_DECL vec<L, T, Q> highestBitValue(vec<L, T, Q> const& value);
  35. /// Return the power of two number which value is just higher the input value.
  36. ///
  37. /// @see gtc_round
  38. /// @see gtx_bit
  39. template<typename genIUType>
  40. [[deprecated("Use ceilPowerOfTwo from GTC_round instead")]]
  41. GLM_FUNC_DECL genIUType powerOfTwoAbove(genIUType Value);
  42. /// Return the power of two number which value is just higher the input value.
  43. ///
  44. /// @see gtc_round
  45. /// @see gtx_bit
  46. template<length_t L, typename T, qualifier Q>
  47. [[deprecated("Use ceilPowerOfTwo from GTC_round instead")]]
  48. GLM_FUNC_DECL vec<L, T, Q> powerOfTwoAbove(vec<L, T, Q> const& value);
  49. /// Return the power of two number which value is just lower the input value.
  50. ///
  51. /// @see gtc_round
  52. /// @see gtx_bit
  53. template<typename genIUType>
  54. [[deprecated("Use floorPowerOfTwo from GTC_round instead")]]
  55. GLM_FUNC_DECL genIUType powerOfTwoBelow(genIUType Value);
  56. /// Return the power of two number which value is just lower the input value.
  57. ///
  58. /// @see gtc_round
  59. /// @see gtx_bit
  60. template<length_t L, typename T, qualifier Q>
  61. [[deprecated("Use floorPowerOfTwo from GTC_round instead")]]
  62. GLM_FUNC_DECL vec<L, T, Q> powerOfTwoBelow(vec<L, T, Q> const& value);
  63. /// Return the power of two number which value is the closet to the input value.
  64. ///
  65. /// @see gtc_round
  66. /// @see gtx_bit
  67. template<typename genIUType>
  68. [[deprecated("Use roundPowerOfTwo from GTC_round instead")]]
  69. GLM_FUNC_DECL genIUType powerOfTwoNearest(genIUType Value);
  70. /// Return the power of two number which value is the closet to the input value.
  71. ///
  72. /// @see gtc_round
  73. /// @see gtx_bit
  74. template<length_t L, typename T, qualifier Q>
  75. [[deprecated("Use roundPowerOfTwo from GTC_round instead")]]
  76. GLM_FUNC_DECL vec<L, T, Q> powerOfTwoNearest(vec<L, T, Q> const& value);
  77. /// @}
  78. } //namespace glm
  79. #include "bit.inl"