1#ifndef SANISIZER_ND_OFFSET_HPP
2#define SANISIZER_ND_OFFSET_HPP
18template<
typename Size_,
typename Extent_,
typename NextIndex_>
19constexpr Size_ nd_offset_internal(Extent_ extent, NextIndex_ pos) {
20 static_assert(std::is_integral<Size_>::value);
24template<
typename Size_,
typename Extent_,
typename NextIndex_,
typename... MoreArgs_>
25constexpr Size_ nd_offset_internal(Extent_ extent, NextIndex_ pos, MoreArgs_... more_args) {
26 static_assert(std::is_integral<Size_>::value);
60template<
typename Size_,
typename FirstIndex_,
typename FirstExtent_,
typename SecondIndex_,
typename... Remaining_>
61constexpr Size_
nd_offset(FirstIndex_ x1, FirstExtent_ extent1, SecondIndex_ x2, Remaining_... remaining) {
62 static_assert(std::is_integral<Size_>::value);
67 return static_cast<Size_
>(
get_value(x1)) + nd_offset_internal<Size_>(extent1, x2, remaining...);
Generics for operating on integer representations.
Sanitize sizes to avoid integer overflow.
Definition Bounded.hpp:15
constexpr auto get_value(const Value_ x)
Definition generics.hpp:23
constexpr Size_ nd_offset(FirstIndex_ x1, FirstExtent_ extent1, SecondIndex_ x2, Remaining_... remaining)
Definition nd_offset.hpp:61