summaryrefslogtreecommitdiffhomepage
path: root/src/boot/BootKit/Shared/base.h
blob: c95db0cc81d38e33b2235f3c34caa906494d8351 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#ifndef UTL_BASE_H
#define UTL_BASE_H

#include <math.h>
#include <stddef.h>
#include <stdint.h>

namespace utl {

/**
 * @brief Helper to get number of elements in array.
 *
 * @tparam T Auto-deduced element type
 * @tparam N Auto-deduced number of elements
 * @return Array size
 */
template <class T, size_t N>
constexpr size_t countof(T (&)[N]) {
  return N;
}

}  // namespace utl

#endif