Added more utility and fixed Flag type.
This commit is contained in:
21
source/mijin/util/align.hpp
Normal file
21
source/mijin/util/align.hpp
Normal file
@@ -0,0 +1,21 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#if !defined(MIJIN_UTIL_ALIGN_HPP_INCLUDED)
|
||||
#define MIJIN_UTIL_ALIGN_HPP_INCLUDED 1
|
||||
|
||||
namespace mijin
|
||||
{
|
||||
template<typename T>
|
||||
constexpr T alignUp(T value, T alignTo) noexcept
|
||||
{
|
||||
if (value % alignTo != 0)
|
||||
{
|
||||
return value + alignTo - (value % alignTo);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
} // namespace mijin
|
||||
|
||||
#endif // !defined(MIJIN_UTIL_ALIGN_HPP_INCLUDED)
|
||||
Reference in New Issue
Block a user