Fast division and modulus by a fixed 32-bit divisor, as FastDivmodU64, for dividends below 2^32-1.
More...
#include <AMReX_Math.H>
|
| | FastDivmodU32 (std::uint32_t divisor_) |
| | Precompute the constants, in host code only.
|
| | FastDivmodU32 ()=default |
| __host__ __device__ std::uint32_t | divide (std::uint32_t dividend) const |
| | floor(dividend / divisor), for dividend < 2^32-1.
|
| __host__ __device__ void | operator() (std::uint32_t "ient, std::uint32_t &remainder, std::uint32_t dividend) const |
Fast division and modulus by a fixed 32-bit divisor, as FastDivmodU64, for dividends below 2^32-1.
The quotient is a 32-bit multiply-high and a shift, which on GPUs is much cheaper than the 64-bit version.
◆ FastDivmodU32() [1/2]
| amrex::Math::FastDivmodU32::FastDivmodU32 |
( |
std::uint32_t | divisor_ | ) |
|
|
inline |
Precompute the constants, in host code only.
◆ FastDivmodU32() [2/2]
| amrex::Math::FastDivmodU32::FastDivmodU32 |
( |
| ) |
|
|
default |
◆ divide()
| __host__ __device__ std::uint32_t amrex::Math::FastDivmodU32::divide |
( |
std::uint32_t | dividend | ) |
const |
|
inlinenodiscard |
floor(dividend / divisor), for dividend < 2^32-1.
◆ operator()()
| __host__ __device__ void amrex::Math::FastDivmodU32::operator() |
( |
std::uint32_t & | quotient, |
|
|
std::uint32_t & | remainder, |
|
|
std::uint32_t | dividend ) const |
|
inline |
◆ divisor
| std::uint32_t amrex::Math::FastDivmodU32::divisor = 0 |
◆ multiplier
| std::uint32_t amrex::Math::FastDivmodU32::multiplier = 1U |
◆ round_up
| unsigned int amrex::Math::FastDivmodU32::round_up = 0 |
◆ shift_right
| unsigned int amrex::Math::FastDivmodU32::shift_right = 0 |
The documentation for this struct was generated from the following file: