openMSX
|
Classes | |
struct | QuotientRemainder |
Divide one integer by another, rounding towards minus infinity. More... | |
Functions | |
constexpr auto | floodRight (std::unsigned_integral auto x) noexcept |
Returns the smallest number of the form 2^n-1 that is greater or equal to the given number. | |
template<std::signed_integral T> | |
int16_t | clipToInt16 (T x) |
Clip x to range [-32768,32767]. | |
uint8_t | clipIntToByte (int x) |
Clip x to range [0,255]. | |
constexpr unsigned | reverseNBits (unsigned x, unsigned bits) |
Reverse the lower N bits of a given value. | |
constexpr uint8_t | reverseByte (uint8_t a) |
Reverse the bits in a byte. | |
unsigned | findFirstSet (uint32_t x) |
Find the least significant bit that is set. | |
constexpr float | cubicHermite (std::span< const float, 4 > y, float x) |
constexpr QuotientRemainder | div_mod_floor (int dividend, int divisor) |
constexpr int | div_floor (int dividend, int divisor) |
constexpr int | mod_floor (int dividend, int divisor) |
Variables | |
constexpr double | e = std::numbers::e_v <double> |
constexpr double | ln2 = std::numbers::ln2_v <double> |
constexpr double | ln10 = std::numbers::ln10_v<double> |
constexpr double | pi = std::numbers::pi_v <double> |
|
inline |
Clip x to range [0,255].
Optimized for the case when no clipping is needed.
Definition at line 61 of file Math.hh.
Referenced by openmsx::VDP::getMSX1Palette(), and TEST_CASE().
|
inline |
Clip x to range [-32768,32767].
Optimized for the case when no clipping is needed.
Definition at line 47 of file Math.hh.
Referenced by openmsx::WavImage::getSampleAt(), openmsx::DCFilter::operator()(), TEST_CASE(), and openmsx::Y8950::writeReg().
|
constexpr |
Definition at line 167 of file Math.hh.
Referenced by openmsx::WavImage::getSampleAt().
|
constexpr |
Definition at line 197 of file Math.hh.
References div_mod_floor(), and Math::QuotientRemainder::quotient.
|
constexpr |
Definition at line 188 of file Math.hh.
Referenced by div_floor(), mod_floor(), and TEST_CASE().
|
inline |
Find the least significant bit that is set.
Definition at line 149 of file Math.hh.
Referenced by openmsx::ColecoJoystickIO::peekIO().
|
constexprnoexcept |
Returns the smallest number of the form 2^n-1 that is greater or equal to the given number.
The resulting number has the same number of leading zeros as the input, but starting from the first 1-bit in the input all bits more to the right are also 1.
Definition at line 32 of file Math.hh.
Referenced by openmsx::VRAMWindow::getReadAreaPlanar(), openmsx::VRAMWindow::isContinuous(), and TEST_CASE().
|
constexpr |
Definition at line 200 of file Math.hh.
References div_mod_floor(), and Math::QuotientRemainder::remainder.
|
constexpr |
Reverse the bits in a byte.
This is equivalent to (but faster than) reverseNBits(x, 8);
Definition at line 125 of file Math.hh.
Referenced by openmsx::ImagePrinter::printGraphicByte(), and openmsx::LaserdiscPlayer::serialize().
|
constexpr |
Reverse the lower N bits of a given value.
The upper 32-N bits from the input are ignored and will be returned as 0. For example reverseNBits('xxxabcde', 5) returns '000edcba' (binary notation).
Definition at line 75 of file Math.hh.
Referenced by openmsx::LaserdiscPlayer::serialize().
|
inlineconstexpr |
Definition at line 21 of file Math.hh.
Referenced by cstd::exp(), and cstd::log().
|
inlineconstexpr |
Definition at line 23 of file Math.hh.
Referenced by cstd::log10().
|
inlineconstexpr |
Definition at line 22 of file Math.hh.
Referenced by cstd::exp2(), and cstd::log2().
|
inlineconstexpr |
Definition at line 24 of file Math.hh.
Referenced by cstd::cos(), gl::degrees(), gl::radians(), openmsx::DCFilter::setFreq(), cstd::sin(), and TEST_CASE().