ToyGine2 26.2.0
Game Engine for retro consoles
Loading...
Searching...
No Matches
fixed.hpp File Reference

Fixed-point numeric type template and related concepts. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  toy::math::fixed< Base, Intermediate, Fraction, Rounding >
 Fixed-point numeric type with configurable storage and fractional precision. More...
class  toy::math::fixed< Base, Intermediate, Fraction, Rounding >::RawConstructorTag
 Internal tag for constructing from raw storage. More...
struct  toy::math::is_fixed_point< T >
 Unary type trait: true if T is an instantiation of toy::math::fixed, false otherwise. More...
struct  toy::math::is_fixed_point< fixed< Base, Intermediate, Fraction, Rounding > >

Namespaces

namespace  toy
 Root namespace containing all engine modules.
namespace  toy::math
 Mathematical types, constants, and utilities: fixed-point, vectors, point.

Concepts

concept  toy::math::ValidFixedPointTypes
 Concept constraining template parameters for toy::math::fixed.
concept  toy::math::fixed_point
 Concept satisfied when T is an instantiation of toy::math::fixed.

Functions

template<typename Base, typename Intermediate, unsigned Fraction, bool Rounding>
constexpr fixed< Base, Intermediate, Fraction, Rounding > toy::math::operator- (const fixed< Base, Intermediate, Fraction, Rounding > &value) noexcept
 Unary minus: returns the negation of a toy::math::fixed value.
template<typename Base, typename Intermediate, unsigned Fraction, bool Rounding, bool OtherRounding>
constexpr fixed< Base, Intermediate, Fraction, Rounding > toy::math::operator+ (const fixed< Base, Intermediate, Fraction, Rounding > &a, const fixed< Base, Intermediate, Fraction, OtherRounding > &b) noexcept
 Returns a + b as a new toy::math::fixed (same type as left operand).
template<typename Base, typename Intermediate, unsigned Fraction, bool Rounding, typename T>
constexpr fixed< Base, Intermediate, Fraction, Rounding > toy::math::operator+ (const fixed< Base, Intermediate, Fraction, Rounding > &a, const T &b) noexcept
 Returns a + b as a new toy::math::fixed (fixed plus integral whole units).
template<typename Base, typename Intermediate, unsigned Fraction, bool Rounding, typename T>
constexpr fixed< Base, Intermediate, Fraction, Rounding > toy::math::operator+ (const T &a, const fixed< Base, Intermediate, Fraction, Rounding > &b) noexcept
 Returns a + b as a new toy::math::fixed (integral whole units plus fixed).
template<typename Base, typename Intermediate, unsigned Fraction, bool Rounding, bool OtherRounding>
constexpr fixed< Base, Intermediate, Fraction, Rounding > toy::math::operator- (const fixed< Base, Intermediate, Fraction, Rounding > &a, const fixed< Base, Intermediate, Fraction, OtherRounding > &b) noexcept
 Returns a - b as a new toy::math::fixed (same type as left operand).
template<typename Base, typename Intermediate, unsigned Fraction, bool Rounding, typename T>
constexpr fixed< Base, Intermediate, Fraction, Rounding > toy::math::operator- (const fixed< Base, Intermediate, Fraction, Rounding > &a, const T &b) noexcept
 Returns a - b as a new toy::math::fixed (fixed minus integral whole units).
template<typename Base, typename Intermediate, unsigned Fraction, bool Rounding, typename T>
constexpr fixed< Base, Intermediate, Fraction, Rounding > toy::math::operator- (const T &a, const fixed< Base, Intermediate, Fraction, Rounding > &b) noexcept
 Returns a - b as a new toy::math::fixed (integral whole units minus fixed).
template<typename Base, typename Intermediate, unsigned Fraction, bool Rounding, bool OtherRounding>
constexpr fixed< Base, Intermediate, Fraction, Rounding > toy::math::operator* (const fixed< Base, Intermediate, Fraction, Rounding > &a, const fixed< Base, Intermediate, Fraction, OtherRounding > &b) noexcept
 Returns a * b as a new toy::math::fixed (same type as left toy::math::fixed operand).
template<typename Base, typename Intermediate, unsigned Fraction, bool Rounding, typename T>
constexpr fixed< Base, Intermediate, Fraction, Rounding > toy::math::operator* (const fixed< Base, Intermediate, Fraction, Rounding > &a, const T &b) noexcept
 Returns a * b as a new toy::math::fixed (fixed times integral whole units).
template<typename Base, typename Intermediate, unsigned Fraction, bool Rounding, typename T>
constexpr fixed< Base, Intermediate, Fraction, Rounding > toy::math::operator* (const T &a, const fixed< Base, Intermediate, Fraction, Rounding > &b) noexcept
 Returns a * b as a new toy::math::fixed (integral whole units times fixed).
template<typename Base, typename Intermediate, unsigned Fraction, bool Rounding, bool OtherRounding>
constexpr fixed< Base, Intermediate, Fraction, Rounding > toy::math::operator/ (const fixed< Base, Intermediate, Fraction, Rounding > &a, const fixed< Base, Intermediate, Fraction, OtherRounding > &b) noexcept
 Returns a / b as a new toy::math::fixed.
template<typename Base, typename Intermediate, unsigned Fraction, bool Rounding, typename T>
constexpr fixed< Base, Intermediate, Fraction, Rounding > toy::math::operator/ (const fixed< Base, Intermediate, Fraction, Rounding > &a, const T &b) noexcept
 Returns a / b as a new toy::math::fixed (fixed divided by integral whole units).
template<typename Base, typename Intermediate, unsigned Fraction, bool Rounding, typename T>
constexpr fixed< Base, Intermediate, Fraction, Rounding > toy::math::operator/ (const T &a, const fixed< Base, Intermediate, Fraction, Rounding > &b) noexcept
 Returns a / b as a new toy::math::fixed (integral whole units divided by fixed).
template<typename Base, typename Intermediate, unsigned Fraction, bool Rounding, bool OtherRounding>
constexpr bool toy::math::operator== (const fixed< Base, Intermediate, Fraction, Rounding > &a, const fixed< Base, Intermediate, Fraction, OtherRounding > &b) noexcept
 Compares two toy::math::fixed values for equality.
template<typename Base, typename Intermediate, unsigned Fraction, bool Rounding, integral T>
constexpr bool toy::math::operator== (const fixed< Base, Intermediate, Fraction, Rounding > &a, const T &b) noexcept
 Compares a toy::math::fixed value with an integral for equality.
template<typename Base, typename Intermediate, unsigned Fraction, bool Rounding, integral T>
constexpr bool toy::math::operator== (const T &a, const fixed< Base, Intermediate, Fraction, Rounding > &b) noexcept
 Compares an integral with a toy::math::fixed value for equality.
template<typename Base, typename Intermediate, unsigned Fraction, bool Rounding, bool OtherRounding>
constexpr strong_ordering toy::math::operator<=> (const fixed< Base, Intermediate, Fraction, Rounding > &a, const fixed< Base, Intermediate, Fraction, OtherRounding > &b) noexcept
 Three-way comparison of two toy::math::fixed values.
template<typename Base, typename Intermediate, unsigned Fraction, bool Rounding, integral T>
constexpr strong_ordering toy::math::operator<=> (const fixed< Base, Intermediate, Fraction, Rounding > &a, const T &b) noexcept
 Three-way comparison of a toy::math::fixed value with an integral.
template<typename Base, typename Intermediate, unsigned Fraction, bool Rounding, integral T>
constexpr strong_ordering toy::math::operator<=> (const T &a, const fixed< Base, Intermediate, Fraction, Rounding > &b) noexcept
 Three-way comparison of an integral with a toy::math::fixed value.

Variables

template<typename T>
constexpr bool toy::math::is_fixed_point_v = is_fixed_point<T>::value
 Helper variable template: true if T is toy::math::fixed, false otherwise.

Detailed Description

Fixed-point numeric type template and related concepts.

Defines toy::math::fixed, toy::math::fixed_point, and supporting traits.

Note
Included by math.hpp; do not include this file directly.