tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
idiv.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2// SPDX-FileCopyrightText: Copyright (C) 2024 Tobias Hienzsch
3
4#ifndef TETL_MATH_IDIV_HPP
5#define TETL_MATH_IDIV_HPP
6
7#include <etl/_concepts/integral.hpp>
8
9namespace etl {
10
11template <integral Int>
13 Int quot;
14 Int rem;
15};
16
17template <integral Int>
18[[nodiscard]] constexpr auto idiv(Int x, Int y) noexcept -> idiv_result<Int>
19{
20 return {static_cast<Int>(x / y), static_cast<Int>(x % y)};
21}
22
23} // namespace etl
24
25#endif // TETL_MATH_IDIV_HPP
Definition adjacent_find.hpp:9
constexpr auto idiv(Int x, Int y) noexcept -> idiv_result< Int >
Definition idiv.hpp:18
Definition idiv.hpp:12
Int quot
Definition idiv.hpp:13
Int rem
Definition idiv.hpp:14