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. /// Deprecated, use ceilPowerOfTwo from GTC_round instead
  37. ///
  38. /// @see gtc_round
  39. /// @see gtx_bit
  40. template<typename genIUType>
  41. GLM_DEPRECATED GLM_FUNC_DECL genIUType powerOfTwoAbove(genIUType Value);
  42. /// Return the power of two number which value is just higher the input value.
  43. /// Deprecated, use ceilPowerOfTwo from GTC_round instead
  44. ///
  45. /// @see gtc_round
  46. /// @see gtx_bit
  47. template<length_t L, typename T, qualifier Q>
  48. GLM_DEPRECATED 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. /// Deprecated, use floorPowerOfTwo from GTC_round instead
  51. ///
  52. /// @see gtc_round
  53. /// @see gtx_bit
  54. template<typename genIUType>
  55. GLM_DEPRECATED GLM_FUNC_DECL genIUType powerOfTwoBelow(genIUType Value);
  56. /// Return the power of two number which value is just lower the input value.
  57. /// Deprecated, use floorPowerOfTwo from GTC_round instead
  58. ///
  59. /// @see gtc_round
  60. /// @see gtx_bit
  61. template<length_t L, typename T, qualifier Q>
  62. GLM_DEPRECATED 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. /// Deprecated, use roundPowerOfTwo from GTC_round instead
  65. ///
  66. /// @see gtc_round
  67. /// @see gtx_bit
  68. template<typename genIUType>
  69. GLM_DEPRECATED GLM_FUNC_DECL genIUType powerOfTwoNearest(genIUType Value);
  70. /// Return the power of two number which value is the closet to the input value.
  71. /// Deprecated, use roundPowerOfTwo from GTC_round instead
  72. ///
  73. /// @see gtc_round
  74. /// @see gtx_bit
  75. template<length_t L, typename T, qualifier Q>
  76. GLM_DEPRECATED GLM_FUNC_DECL vec<L, T, Q> powerOfTwoNearest(vec<L, T, Q> const& value);
  77. /// @}
  78. } //namespace glm
  79. #include "bit.inl"