bit.hpp 3.0 KB

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