summaryrefslogtreecommitdiffhomepage
path: root/src/boot/BootKit/Shared/base.h
blob: 4d2d9a91caa7e01159a896bde0c563255e0fd8a4 (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
25
26
27
28
// Copyright 2024-2025, Amlal El Mahrouss (amlal@nekernel.org)
// Licensed under the Apache License, Version 2.0 (see LICENSE file)
// Official repository: https://github.com/nekernel-org/nekernel

#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