master
ブランチ master
VulkanExample / dep / include / glm / ext / scalar_integer.hpp
2.7 KB、92行 生 Blame 履歴
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
11#pragma once
12
13// Dependencies
14#include "../detail/setup.hpp"
15#include "../detail/qualifier.hpp"
16#include "../detail/_vectorize.hpp"
17#include "../detail/type_float.hpp"
18#include "../vector_relational.hpp"
19#include "../common.hpp"
20#include <limits>
21
22#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
23# pragma message("GLM: GLM_EXT_scalar_integer extension included")
24#endif
25
26namespace glm
27{
28 /// @addtogroup ext_scalar_integer
29 /// @{
30
31 /// Return true if the value is a power of two number.
32 ///
33 /// @see ext_scalar_integer
34 template<typename genIUType>
35 GLM_FUNC_DECL bool isPowerOfTwo(genIUType v);
36
37 /// Return the power of two number which value is just higher the input value,
38 /// round up to a power of two.
39 ///
40 /// @see ext_scalar_integer
41 template<typename genIUType>
42 GLM_FUNC_DECL genIUType nextPowerOfTwo(genIUType v);
43
44 /// Return the power of two number which value is just lower the input value,
45 /// round down to a power of two.
46 ///
47 /// @see ext_scalar_integer
48 template<typename genIUType>
49 GLM_FUNC_DECL genIUType prevPowerOfTwo(genIUType v);
50
51 /// Return true if the 'Value' is a multiple of 'Multiple'.
52 ///
53 /// @see ext_scalar_integer
54 template<typename genIUType>
55 GLM_FUNC_DECL bool isMultiple(genIUType v, genIUType Multiple);
56
57 /// Higher multiple number of Source.
58 ///
59 /// @tparam genIUType Integer scalar or vector types.
60 ///
61 /// @param v Source value to which is applied the function
62 /// @param Multiple Must be a null or positive value
63 ///
64 /// @see ext_scalar_integer
65 template<typename genIUType>
66 GLM_FUNC_DECL genIUType nextMultiple(genIUType v, genIUType Multiple);
67
68 /// Lower multiple number of Source.
69 ///
70 /// @tparam genIUType Integer scalar or vector types.
71 ///
72 /// @param v Source value to which is applied the function
73 /// @param Multiple Must be a null or positive value
74 ///
75 /// @see ext_scalar_integer
76 template<typename genIUType>
77 GLM_FUNC_DECL genIUType prevMultiple(genIUType v, genIUType Multiple);
78
79 /// Returns the bit number of the Nth significant bit set to
80 /// 1 in the binary representation of value.
81 /// If value bitcount is less than the Nth significant bit, -1 will be returned.
82 ///
83 /// @tparam genIUType Signed or unsigned integer scalar types.
84 ///
85 /// @see ext_scalar_integer
86 template<typename genIUType>
87 GLM_FUNC_DECL int findNSB(genIUType x, int significantBitCount);
88
89 /// @}
90} //namespace glm
91
92#include "scalar_integer.inl"