2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2023-12-04 18:51:53 +08:00
|
|
|
* Copyright (C) 2020-2023 Intel Corporation
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
2018-09-18 15:11:08 +08:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <stddef.h>
|
|
|
|
|
2023-12-04 18:51:53 +08:00
|
|
|
template <typename T, size_t n>
|
|
|
|
constexpr size_t arrayCount(const T (&)[n]) {
|
|
|
|
return n;
|
2017-12-21 07:45:38 +08:00
|
|
|
}
|
|
|
|
|
2023-12-04 18:51:53 +08:00
|
|
|
template <typename T, size_t n>
|
|
|
|
constexpr bool isInRange(size_t idx, const T (&)[n]) {
|
|
|
|
return (idx < n);
|
2017-12-21 07:45:38 +08:00
|
|
|
}
|