MCPcopy Create free account
hub / github.com/KhronosGroup/Vulkan-ValidationLayers / AlignToMultiple

Function AlignToMultiple

layers/utils/math_utils.h:122–126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

120// returns the smallest multiple of p greater than or equal to x
121template <typename T>
122constexpr T AlignToMultiple(T x, T p) {
123 static_assert(std::numeric_limits<T>::is_integer, "Unsigned integer required.");
124 static_assert(std::is_unsigned<T>::value, "Unsigned integer required.");
125 return ((x + p - 1) / p) * p;
126}
127
128// Returns the 0-based index of the LSB. An input mask of 0 yields -1
129static inline int LeastSignificantBit(uint32_t mask) { return u_ffs(static_cast<int>(mask)) - 1; }

Callers 4

TEST_FFunction · 0.85
TEST_FFunction · 0.85
TEST_FFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected