openMSX
Classes | Namespaces | Functions | Variables
Math.hh File Reference
#include "narrow.hh"
#include <bit>
#include <cassert>
#include <climits>
#include <cmath>
#include <concepts>
#include <cstdint>
#include <numbers>
#include <span>
Include dependency graph for Math.hh:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Math::QuotientRemainder
 Divide one integer by another, rounding towards minus infinity. More...
 

Namespaces

namespace  Math
 

Functions

constexpr auto Math::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 Math::clipToInt16 (T x)
 Clip x to range [-32768,32767].
 
uint8_t Math::clipIntToByte (int x)
 Clip x to range [0,255].
 
constexpr unsigned Math::reverseNBits (unsigned x, unsigned bits)
 Reverse the lower N bits of a given value.
 
constexpr uint8_t Math::reverseByte (uint8_t a)
 Reverse the bits in a byte.
 
unsigned Math::findFirstSet (uint32_t x)
 Find the least significant bit that is set.
 
constexpr float Math::cubicHermite (std::span< const float, 4 > y, float x)
 
constexpr QuotientRemainder Math::div_mod_floor (int dividend, int divisor)
 
constexpr int Math::div_floor (int dividend, int divisor)
 
constexpr int Math::mod_floor (int dividend, int divisor)
 

Variables

constexpr double Math::e = std::numbers::e_v <double>
 
constexpr double Math::ln2 = std::numbers::ln2_v <double>
 
constexpr double Math::ln10 = std::numbers::ln10_v<double>
 
constexpr double Math::pi = std::numbers::pi_v <double>