#include <AMReX_Math.H>
Public Member Functions | |
FastDivmodU64 (std::uint64_t divisor_) | |
FastDivmodU64 ()=default | |
Default construct an invalid FastDivmodU64. More... | |
AMREX_GPU_HOST_DEVICE std::uint64_t | divide (std::uint64_t dividend) const |
Returns the quotient of floor(dividend / divisor) More... | |
AMREX_GPU_HOST_DEVICE std::uint64_t | modulus (std::uint64_t quotient, std::uint64_t dividend) const |
Computes the remainder given a computed quotient and dividend. More... | |
AMREX_GPU_HOST_DEVICE std::uint64_t | divmod (std::uint64_t &remainder, std::uint64_t dividend) const |
Returns the quotient of floor(dividend / divisor) and computes the remainder. More... | |
AMREX_GPU_HOST_DEVICE void | operator() (std::uint64_t "ient, std::uint64_t &remainder, std::uint64_t dividend) const |
Public Attributes | |
std::uint64_t | divisor = 0 |
Object to encapsulate the fast division+modulus operation for 64b integer division.
Example:
uint64_t quotient, remainder, dividend, divisor;
FastDivmodU64 divmod(divisor);
divmod(quotient, remainder, dividend);
// quotient = (dividend / divisor) // remainder = (dividend % divisor)
|
inline |
|
default |
Default construct an invalid FastDivmodU64.
|
inline |
Returns the quotient of floor(dividend / divisor)
|
inline |
Returns the quotient of floor(dividend / divisor) and computes the remainder.
|
inline |
Computes the remainder given a computed quotient and dividend.
|
inline |
Computes integer division and modulus using precomputed values. This is computationally inexpensive.
std::uint64_t amrex::Math::FastDivmodU64::divisor = 0 |