SaturnRingLibrary 0.9.1
SGL wrapper
 
Loading...
Searching...
No Matches

◆ Fxp() [4/4]

template<typename T>
requires (!std::is_same_v<T, int16_t>)
SRL::Math::Types::Fxp::Fxp ( const T & value)
inlineconsteval

Compile-time constructor for numeric types other than int16_t.

Template Parameters
TNumeric type (e.g., float, double, int32_t)
Parameters
valueThe value to convert to fixed-point

This constructor is only available at compile time. For runtime conversions, use Convert():

// Compile-time conversion (preferred when possible)
constexpr Fxp a = 3.14159; // Exact conversion at compile-time
// Runtime conversion
Fxp b = Fxp::Convert(someFloat); // Will warn about floating-point performance
static constexpr Fxp Convert(const T &value)
Convert integral type to fixed-point with compile-time range validation.
Definition fxp.hpp:156
Note
Only available at compile time (consteval).
Warning
Values outside the valid fixed-point range may cause overflow.