Helper function for 96/32 signed division, rounding towards negative infinity (if round_down), or towards positive infinity (if !round_down). This is a version relying on __int128.
Synopsis
Declared in <util/feefrac.h>
static
int64_t
Div(
__int128 n,
int32_t d,
bool round_down) noexcept;
Description
The result must fit in an int64_t, and d must be strictly positive.
Return Value
The quotient, rounded as requested.
Parameters
Name |
Description |
n |
The 128‐bit signed dividend. |
d |
The strictly positive 32‐bit divisor. |
round_down |
Whether to round towards negative infinity (true) or positive infinity (false). |
Created with MrDocs