1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// SPDX-FileCopyrightText: 2026 John Moxley
// SPDX-License-Identifier: MIT OR Apache-2.0
//! Signed remainder via the division policy.
//!
//! [`rem_via_div_rem`] is the width-agnostic remainder algorithm selected by
//! the remainder policy [`crate::int::policy::rem::dispatch`]. It derives the
//! remainder by delegating to [`crate::int::policy::div_rem::dispatch`] — the
//! single division optimization boundary — and taking the remainder half.
//! NOT `const fn`: the division dispatcher is a runtime-shape value-matcher.
use cratedispatch as div_rem_dispatch;
use crateInt;
/// Signed remainder via the division policy for `Int<N>`. Strips the
/// operand signs, calls [`div_rem_dispatch`] on the unsigned magnitudes,
/// re-applies the dividend's sign to the remainder (truncating-toward-zero
/// semantics), and returns the signed result.
///
/// Delegates to [`crate::int::policy::div_rem::dispatch`] — the single
/// site the division optimization boundary lives at — rather than
/// reimplementing the Knuth / Burnikel–Ziegler engine selection inline.
/// `div_rem_dispatch` is NOT `const fn` (its value-matcher invokes a fn
/// pointer at runtime), so this algorithm fn is not `const fn` either.
/// The caller (`dispatch`) is correspondingly non-const.
///
/// Panics on a zero divisor, matching the `Rem` operator contract.
pub