bit.hpp 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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. #endif
  18. #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
  19. # pragma message("GLM: GLM_GTX_bit extension is deprecated, include GLM_GTC_bitfield and GLM_GTC_integer instead")
  20. #endif
  21. namespace glm
  22. {
  23. /// @addtogroup gtx_bit
  24. /// @{
  25. /// @see gtx_bit
  26. template<typename genIUType>
  27. GLM_FUNC_DECL genIUType highestBitValue(genIUType Value);
  28. /// @see gtx_bit
  29. template<typename genIUType>
  30. GLM_FUNC_DECL genIUType lowestBitValue(genIUType Value);
  31. /// Find the highest bit set to 1 in a integer variable and return its value.
  32. ///
  33. /// @see gtx_bit
  34. template<length_t L, typename T, qualifier Q>
  35. GLM_FUNC_DECL vec<L, T, Q> highestBitValue(vec<L, T, Q> const& value);
  36. /// Return the power of two number which value is just higher the input value.
  37. /// Deprecated, use ceilPowerOfTwo from GTC_round instead
  38. ///
  39. /// @see gtc_round
  40. /// @see gtx_bit
  41. template<typename genIUType>
  42. GLM_DEPRECATED GLM_FUNC_DECL genIUType powerOfTwoAbove(genIUType Value);
  43. /// Return the power of two number which value is just higher the input value.
  44. /// Deprecated, use ceilPowerOfTwo from GTC_round instead
  45. ///
  46. /// @see gtc_round
  47. /// @see gtx_bit
  48. template<length_t L, typename T, qualifier Q>
  49. GLM_DEPRECATED GLM_FUNC_DECL vec<L, T, Q> powerOfTwoAbove(vec<L, T, Q> const& value);
  50. /// Return the power of two number which value is just lower the input value.
  51. /// Deprecated, use floorPowerOfTwo from GTC_round instead
  52. ///
  53. /// @see gtc_round
  54. /// @see gtx_bit
  55. template<typename genIUType>
  56. GLM_DEPRECATED GLM_FUNC_DECL genIUType powerOfTwoBelow(genIUType Value);
  57. /// Return the power of two number which value is just lower the input value.
  58. /// Deprecated, use floorPowerOfTwo from GTC_round instead
  59. ///
  60. /// @see gtc_round
  61. /// @see gtx_bit
  62. template<length_t L, typename T, qualifier Q>
  63. GLM_DEPRECATED GLM_FUNC_DECL vec<L, T, Q> powerOfTwoBelow(vec<L, T, Q> const& value);
  64. /// Return the power of two number which value is the closet to the input value.
  65. /// Deprecated, use roundPowerOfTwo from GTC_round instead
  66. ///
  67. /// @see gtc_round
  68. /// @see gtx_bit
  69. template<typename genIUType>
  70. GLM_DEPRECATED GLM_FUNC_DECL genIUType powerOfTwoNearest(genIUType Value);
  71. /// Return the power of two number which value is the closet to the input value.
  72. /// Deprecated, use roundPowerOfTwo from GTC_round instead
  73. ///
  74. /// @see gtc_round
  75. /// @see gtx_bit
  76. template<length_t L, typename T, qualifier Q>
  77. GLM_DEPRECATED GLM_FUNC_DECL vec<L, T, Q> powerOfTwoNearest(vec<L, T, Q> const& value);
  78. /// @}
  79. } //namespace glm
  80. #include "bit.inl"