| 1 | // |
| 2 | // SPDX-FileCopyrightText: Copyright 2026 Arm Limited and/or its affiliates <open-source-office@arm.com> |
| 3 | // |
| 4 | // SPDX-License-Identifier: Apache-2.0 |
| 5 | // |
| 6 | |
| 7 | #pragma once |
| 8 | |
| 9 | #include <cstddef> |
| 10 | #include <type_traits> |
| 11 | |
| 12 | namespace kai::test { |
| 13 | |
| 14 | /// Value range |
| 15 | template <typename T> |
| 16 | struct Range { |
| 17 | T min; |
| 18 | T max; |
| 19 | |
| 20 | [[nodiscard]] std::size_t inclusive_count() const { |
| 21 | static_assert(std::is_integral_v<T>); |
| 22 | return max - min + 1; |
| 23 | } |
| 24 | |
| 25 | [[nodiscard]] bool is_valid() const { |
| 26 | return min <= max; |
| 27 | } |
| 28 | }; |
| 29 | |
| 30 | } // namespace kai::test |