mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 12:17:44 +00:00
AK: Mark some helper things constexpr.
This commit is contained in:
parent
bf97b9589d
commit
2dd54f062a
2 changed files with 4 additions and 4 deletions
|
@ -47,19 +47,19 @@ inline constexpr dword round_up_to_power_of_two(dword value, dword power_of_two)
|
||||||
namespace AK {
|
namespace AK {
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline T min(const T& a, const T& b)
|
inline constexpr T min(const T& a, const T& b)
|
||||||
{
|
{
|
||||||
return a < b ? a : b;
|
return a < b ? a : b;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline T max(const T& a, const T& b)
|
inline constexpr T max(const T& a, const T& b)
|
||||||
{
|
{
|
||||||
return a < b ? b : a;
|
return a < b ? b : a;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T, typename U>
|
template<typename T, typename U>
|
||||||
static inline T ceil_div(T a, U b)
|
inline constexpr T ceil_div(T a, U b)
|
||||||
{
|
{
|
||||||
static_assert(sizeof(T) == sizeof(U));
|
static_assert(sizeof(T) == sizeof(U));
|
||||||
T result = a / b;
|
T result = a / b;
|
||||||
|
|
|
@ -66,7 +66,7 @@ private:
|
||||||
char m_inline_buffer[0];
|
char m_inline_buffer[0];
|
||||||
};
|
};
|
||||||
|
|
||||||
inline dword string_hash(const char* characters, int length)
|
inline constexpr dword string_hash(const char* characters, int length)
|
||||||
{
|
{
|
||||||
dword hash = 0;
|
dword hash = 0;
|
||||||
for (int i = 0; i < length; ++i) {
|
for (int i = 0; i < length; ++i) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue