gdk-graphics
0a0aef92e917cfbac53dffbc32c295e4de914093
Loading...
Searching...
No Matches
include
gdk
graphics
constraints.h
1
// © Joseph Cameron - MIT License
2
3
#ifndef GDK_GRAPHICS_CONSTRAINTS_H
4
#define GDK_GRAPHICS_CONSTRAINTS_H
5
6
#include <cstddef>
7
8
namespace
gdk::graphics {
9
constexpr
bool
is_power_of_two(
const
std::size_t aNumber) {
10
return
aNumber != 0 && (aNumber & (aNumber - 1)) == 0;
11
}
12
14
constexpr
std::size_t square_root(
const
std::size_t aNumber) {
15
std::size_t root = 0;
16
17
while
((root + 1) * (root + 1) <= aNumber) ++root;
18
19
return
root;
20
}
21
}
22
23
#endif
24
Generated by
1.15.0