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
9
namespace
etl
{
10
11
template
<integral Int>
12
struct
idiv_result
{
13
Int
quot
;
14
Int
rem
;
15
};
16
17
template
<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
etl
Definition
adjacent_find.hpp:9
etl::idiv
constexpr auto idiv(Int x, Int y) noexcept -> idiv_result< Int >
Definition
idiv.hpp:18
etl::idiv_result
Definition
idiv.hpp:12
etl::idiv_result::quot
Int quot
Definition
idiv.hpp:13
etl::idiv_result::rem
Int rem
Definition
idiv.hpp:14
include
etl
_math
idiv.hpp
Generated on Sun Sep 7 2025 19:15:09 for tetl by
1.9.8