Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
FGenericPlatformMath Struct Reference

#include <GenericPlatformMath.h>

+ Inheritance diagram for FGenericPlatformMath:

Public Member Functions

 RESOLVE_FLOAT_AMBIGUITY_2_ARGS (LogX)
 
 RESOLVE_FLOAT_AMBIGUITY_2_ARGS (Fmod)
 
 RESOLVE_FLOAT_AMBIGUITY_2_ARGS (Atan2)
 
 RESOLVE_FLOAT_AMBIGUITY_2_ARGS (Pow)
 
 MIX_FLOATS_2_ARGS (Max)
 
 MIX_FLOATS_2_ARGS (Min)
 
 MIX_SIGNED_INTS_2_ARGS_CONSTEXPR (Max)
 
 MIX_SIGNED_INTS_2_ARGS_CONSTEXPR (Min)
 
template<>
FORCEINLINE VectorRegister4Float Min (const VectorRegister4Float A, const VectorRegister4Float B)
 
template<>
FORCEINLINE VectorRegister4Double Min (const VectorRegister4Double A, const VectorRegister4Double B)
 
template<>
FORCEINLINE VectorRegister4Float Max (const VectorRegister4Float A, const VectorRegister4Float B)
 
template<>
FORCEINLINE VectorRegister4Double Max (const VectorRegister4Double A, const VectorRegister4Double B)
 
template<>
FORCEINLINE float Abs (const float A)
 
template<>
FORCEINLINE double Abs (const double A)
 

Static Public Member Functions

static FORCEINLINE float LoadHalf (const uint16 *Ptr)
 
static FORCEINLINE void StoreHalf (uint16 *Ptr, float Value)
 
static FORCEINLINE void VectorLoadHalf (float *RESTRICT Dst, const uint16 *RESTRICT Src)
 
static FORCEINLINE void VectorStoreHalf (uint16 *RESTRICT Dst, const float *RESTRICT Src)
 
static FORCEINLINE void WideVectorLoadHalf (float *RESTRICT Dst, const uint16 *RESTRICT Src)
 
static FORCEINLINE void WideVectorStoreHalf (uint16 *RESTRICT Dst, const float *RESTRICT Src)
 
static uint32 AsUInt (float F)
 
static uint64 AsUInt (double F)
 
static float AsFloat (uint32 U)
 
static double AsFloat (uint64 U)
 
static CONSTEXPR FORCEINLINE int32 TruncToInt32 (float F)
 
static CONSTEXPR FORCEINLINE int32 TruncToInt32 (double F)
 
static CONSTEXPR FORCEINLINE int64 TruncToInt64 (double F)
 
static CONSTEXPR FORCEINLINE int32 TruncToInt (float F)
 
static CONSTEXPR FORCEINLINE int64 TruncToInt (double F)
 
static FORCEINLINE float TruncToFloat (float F)
 
static FORCEINLINE double TruncToDouble (double F)
 
static FORCEINLINE double TruncToFloat (double F)
 
static FORCEINLINE int32 FloorToInt32 (float F)
 
static FORCEINLINE int32 FloorToInt32 (double F)
 
static FORCEINLINE int64 FloorToInt64 (double F)
 
static FORCEINLINE int32 FloorToInt (float F)
 
static FORCEINLINE int64 FloorToInt (double F)
 
static FORCEINLINE float FloorToFloat (float F)
 
static FORCEINLINE double FloorToDouble (double F)
 
static FORCEINLINE double FloorToFloat (double F)
 
static FORCEINLINE int32 RoundToInt32 (float F)
 
static FORCEINLINE int32 RoundToInt32 (double F)
 
static FORCEINLINE int64 RoundToInt64 (double F)
 
static FORCEINLINE int32 RoundToInt (float F)
 
static FORCEINLINE int64 RoundToInt (double F)
 
static FORCEINLINE float RoundToFloat (float F)
 
static FORCEINLINE double RoundToDouble (double F)
 
static FORCEINLINE double RoundToFloat (double F)
 
static FORCEINLINE int32 CeilToInt32 (float F)
 
static FORCEINLINE int32 CeilToInt32 (double F)
 
static FORCEINLINE int64 CeilToInt64 (double F)
 
static FORCEINLINE int32 CeilToInt (float F)
 
static FORCEINLINE int64 CeilToInt (double F)
 
static FORCEINLINE float CeilToFloat (float F)
 
static FORCEINLINE double CeilToDouble (double F)
 
static FORCEINLINE double CeilToFloat (double F)
 
static int64 RoundToNearestTiesToEven (double F)
 
static FORCEINLINE float Fractional (float Value)
 
static FORCEINLINE double Fractional (double Value)
 
static FORCEINLINE float Frac (float Value)
 
static FORCEINLINE double Frac (double Value)
 
static FORCEINLINE float Modf (const float InValue, float *OutIntPart)
 
static FORCEINLINE double Modf (const double InValue, double *OutIntPart)
 
static FORCEINLINE float Exp (float Value)
 
static FORCEINLINE double Exp (double Value)
 
static FORCEINLINE float Exp2 (float Value)
 
static FORCEINLINE double Exp2 (double Value)
 
static FORCEINLINE float Loge (float Value)
 
static FORCEINLINE double Loge (double Value)
 
static FORCEINLINE float LogX (float Base, float Value)
 
static FORCEINLINE double LogX (double Base, double Value)
 
static FORCEINLINE float Log2 (float Value)
 
static FORCEINLINE double Log2 (double Value)
 
static FORCENOINLINE float Fmod (float X, float Y)
 
static FORCENOINLINE double Fmod (double X, double Y)
 
static FORCEINLINE float Sin (float Value)
 
static FORCEINLINE double Sin (double Value)
 
static FORCEINLINE float Asin (float Value)
 
static FORCEINLINE double Asin (double Value)
 
static FORCEINLINE float Sinh (float Value)
 
static FORCEINLINE double Sinh (double Value)
 
static FORCEINLINE float Cos (float Value)
 
static FORCEINLINE double Cos (double Value)
 
static FORCEINLINE float Acos (float Value)
 
static FORCEINLINE double Acos (double Value)
 
static FORCEINLINE float Tan (float Value)
 
static FORCEINLINE double Tan (double Value)
 
static FORCEINLINE float Atan (float Value)
 
static FORCEINLINE double Atan (double Value)
 
static float Atan2 (float Y, float X)
 
static double Atan2 (double Y, double X)
 
static FORCEINLINE float Sqrt (float Value)
 
static FORCEINLINE double Sqrt (double Value)
 
static FORCEINLINE float Pow (float A, float B)
 
static FORCEINLINE double Pow (double A, double B)
 
static FORCEINLINE float InvSqrt (float F)
 
static FORCEINLINE double InvSqrt (double F)
 
static FORCEINLINE float InvSqrtEst (float F)
 
static FORCEINLINE double InvSqrtEst (double F)
 
static FORCEINLINE bool IsNaN (float A)
 
static FORCEINLINE bool IsNaN (double A)
 
static FORCEINLINE bool IsFinite (float A)
 
static FORCEINLINE bool IsFinite (double A)
 
static FORCEINLINE bool IsNegativeOrNegativeZero (float A)
 
static FORCEINLINE bool IsNegativeOrNegativeZero (double A)
 
static FORCEINLINE bool IsNegativeFloat (float A)
 
static FORCEINLINE bool IsNegativeDouble (double A)
 
static FORCEINLINE bool IsNegative (float A)
 
static FORCEINLINE bool IsNegative (double A)
 
static FORCEINLINE int32 Rand ()
 
static FORCEINLINE void RandInit (int32 Seed)
 
static FORCEINLINE float FRand ()
 
static void SRandInit (int32 Seed)
 
static int32 GetRandSeed ()
 
static float SRand ()
 
static FORCEINLINE uint32 FloorLog2 (uint32 Value)
 
static FORCEINLINE uint64 FloorLog2_64 (uint64 Value)
 
static FORCEINLINE uint8 CountLeadingZeros8 (uint8 Value)
 
static FORCEINLINE uint32 CountLeadingZeros (uint32 Value)
 
static FORCEINLINE uint64 CountLeadingZeros64 (uint64 Value)
 
static FORCEINLINE uint32 CountTrailingZeros (uint32 Value)
 
static FORCEINLINE uint64 CountTrailingZeros64 (uint64 Value)
 
static FORCEINLINE uint32 CeilLogTwo (uint32 Arg)
 
static FORCEINLINE uint64 CeilLogTwo64 (uint64 Arg)
 
static FORCEINLINE constexpr uint8 ConstExprCeilLogTwo (SIZE_T Arg)
 
static FORCEINLINE uint32 RoundUpToPowerOfTwo (uint32 Arg)
 
static FORCEINLINE uint64 RoundUpToPowerOfTwo64 (uint64 V)
 
static FORCEINLINE uint32 MortonCode2 (uint32 x)
 
static FORCEINLINE uint64 MortonCode2_64 (uint64 x)
 
static FORCEINLINE uint32 ReverseMortonCode2 (uint32 x)
 
static FORCEINLINE uint64 ReverseMortonCode2_64 (uint64 x)
 
static FORCEINLINE uint32 MortonCode3 (uint32 x)
 
static FORCEINLINE uint32 ReverseMortonCode3 (uint32 x)
 
static CONSTEXPR FORCEINLINE float FloatSelect (float Comparand, float ValueGEZero, float ValueLTZero)
 
static CONSTEXPR FORCEINLINE double FloatSelect (double Comparand, double ValueGEZero, double ValueLTZero)
 
template<class T >
static CONSTEXPR FORCEINLINE T Abs (const T A)
 
template<class T >
static CONSTEXPR FORCEINLINE T Sign (const T A)
 
template<class T >
static CONSTEXPR FORCEINLINE T Max (const T A, const T B)
 
template<class T >
static CONSTEXPR FORCEINLINE T Min (const T A, const T B)
 
template<class T >
static FORCEINLINE T Min (const TArray< T > &Values, int32 *MinIndex=NULL)
 
template<class T >
static FORCEINLINE T Max (const TArray< T > &Values, int32 *MaxIndex=NULL)
 
static FORCEINLINE int32 CountBits (uint64 Bits)
 

Static Private Member Functions

static void FmodReportError (float X, float Y)
 
static void FmodReportError (double X, double Y)
 

Detailed Description

Generic implementation for most platforms

Definition at line 27 of file GenericPlatformMath.h.

Member Function Documentation

◆ Abs() [1/3]

template<>
FORCEINLINE double FGenericPlatformMath::Abs ( const double A)

Definition at line 1030 of file GenericPlatformMath.h.

◆ Abs() [2/3]

template<>
FORCEINLINE float FGenericPlatformMath::Abs ( const float A)

Float specialization

Definition at line 1025 of file GenericPlatformMath.h.

◆ Abs() [3/3]

template<class T >
static CONSTEXPR FORCEINLINE T FGenericPlatformMath::Abs ( const T A)
inlinestatic

Computes absolute value in a generic way

Definition at line 894 of file GenericPlatformMath.h.

◆ Acos() [1/2]

static FORCEINLINE double FGenericPlatformMath::Acos ( double Value)
inlinestatic

Definition at line 526 of file GenericPlatformMath.h.

◆ Acos() [2/2]

static FORCEINLINE float FGenericPlatformMath::Acos ( float Value)
inlinestatic

Definition at line 525 of file GenericPlatformMath.h.

◆ AsFloat() [1/2]

static float FGenericPlatformMath::AsFloat ( uint32 U)
inlinestatic

Performs a bit cast of the given unsigned int to float of the same bit width.

Parameters
UThe 32-bit unsigned int to bit cast to a 32-bit float.
Returns
A bitwise copy of the 32-bit float in a 32-bit unsigned integer value.

Definition at line 181 of file GenericPlatformMath.h.

◆ AsFloat() [2/2]

static double FGenericPlatformMath::AsFloat ( uint64 U)
inlinestatic

Performs a bit cast of the given unsigned int to float of the same bit width.

Parameters
UThe 64-bit unsigned int to bit cast to a 64-bit float.
Returns
A bitwise copy of the 64-bit float in a 64-bit unsigned integer value.

Definition at line 194 of file GenericPlatformMath.h.

◆ Asin() [1/2]

static FORCEINLINE double FGenericPlatformMath::Asin ( double Value)
inlinestatic

Definition at line 517 of file GenericPlatformMath.h.

◆ Asin() [2/2]

static FORCEINLINE float FGenericPlatformMath::Asin ( float Value)
inlinestatic

Definition at line 516 of file GenericPlatformMath.h.

◆ AsUInt() [1/2]

static uint64 FGenericPlatformMath::AsUInt ( double F)
inlinestatic

Performs a bit cast of the given double to an unsigned int of the same bit width.

Parameters
DThe double to bit cast to an unsigned integer.
Returns
A bitwise copy of the double in a 64-bit unsigned integer value.

Definition at line 168 of file GenericPlatformMath.h.

◆ AsUInt() [2/2]

static uint32 FGenericPlatformMath::AsUInt ( float F)
inlinestatic

Performs a bit cast of the given float to an unsigned int of the same bit width.

Parameters
FThe float to bit cast to an unsigned integer.
Returns
A bitwise copy of the float in a 32-bit unsigned integer value.

Definition at line 155 of file GenericPlatformMath.h.

◆ Atan() [1/2]

static FORCEINLINE double FGenericPlatformMath::Atan ( double Value)
inlinestatic

Definition at line 532 of file GenericPlatformMath.h.

◆ Atan() [2/2]

static FORCEINLINE float FGenericPlatformMath::Atan ( float Value)
inlinestatic

Definition at line 531 of file GenericPlatformMath.h.

◆ Atan2() [1/2]

static double FGenericPlatformMath::Atan2 ( double Y,
double X )
static

◆ Atan2() [2/2]

static float FGenericPlatformMath::Atan2 ( float Y,
float X )
static

◆ CeilLogTwo()

static FORCEINLINE uint32 FGenericPlatformMath::CeilLogTwo ( uint32 Arg)
inlinestatic

Returns smallest N such that (1<<N)>=Arg. Note: CeilLogTwo(0)=0

Definition at line 754 of file GenericPlatformMath.h.

◆ CeilLogTwo64()

static FORCEINLINE uint64 FGenericPlatformMath::CeilLogTwo64 ( uint64 Arg)
inlinestatic

Definition at line 761 of file GenericPlatformMath.h.

◆ CeilToDouble()

static FORCEINLINE double FGenericPlatformMath::CeilToDouble ( double F)
inlinestatic

Converts a double to the nearest greater or equal integer.

Parameters
FFloating point value to convert
Returns
An integer greater or equal to 'F'.

Definition at line 390 of file GenericPlatformMath.h.

◆ CeilToFloat() [1/2]

static FORCEINLINE double FGenericPlatformMath::CeilToFloat ( double F)
inlinestatic

Definition at line 395 of file GenericPlatformMath.h.

◆ CeilToFloat() [2/2]

static FORCEINLINE float FGenericPlatformMath::CeilToFloat ( float F)
inlinestatic

Converts a float to the nearest greater or equal integer.

Parameters
FFloating point value to convert
Returns
An integer greater or equal to 'F'.

Definition at line 380 of file GenericPlatformMath.h.

◆ CeilToInt() [1/2]

static FORCEINLINE int64 FGenericPlatformMath::CeilToInt ( double F)
inlinestatic

Definition at line 373 of file GenericPlatformMath.h.

◆ CeilToInt() [2/2]

static FORCEINLINE int32 FGenericPlatformMath::CeilToInt ( float F)
inlinestatic

Definition at line 372 of file GenericPlatformMath.h.

◆ CeilToInt32() [1/2]

static FORCEINLINE int32 FGenericPlatformMath::CeilToInt32 ( double F)
inlinestatic

Definition at line 359 of file GenericPlatformMath.h.

◆ CeilToInt32() [2/2]

static FORCEINLINE int32 FGenericPlatformMath::CeilToInt32 ( float F)
inlinestatic

Converts a float to the nearest greater or equal integer.

Parameters
FFloating point value to convert
Returns
An integer greater or equal to 'F'.

Definition at line 353 of file GenericPlatformMath.h.

◆ CeilToInt64()

static FORCEINLINE int64 FGenericPlatformMath::CeilToInt64 ( double F)
inlinestatic

Definition at line 365 of file GenericPlatformMath.h.

◆ ConstExprCeilLogTwo()

static FORCEINLINE constexpr uint8 FGenericPlatformMath::ConstExprCeilLogTwo ( SIZE_T Arg)
inlinestaticconstexpr

Returns the smallest N such that (1<<N)>=Arg. This is a less efficient version of CeilLogTwo, but written in a way that can be evaluated at compile-time.

Definition at line 772 of file GenericPlatformMath.h.

◆ Cos() [1/2]

static FORCEINLINE double FGenericPlatformMath::Cos ( double Value)
inlinestatic

Definition at line 523 of file GenericPlatformMath.h.

◆ Cos() [2/2]

static FORCEINLINE float FGenericPlatformMath::Cos ( float Value)
inlinestatic

Definition at line 522 of file GenericPlatformMath.h.

◆ CountBits()

static FORCEINLINE int32 FGenericPlatformMath::CountBits ( uint64 Bits)
inlinestatic

Definition at line 1002 of file GenericPlatformMath.h.

◆ CountLeadingZeros()

static FORCEINLINE uint32 FGenericPlatformMath::CountLeadingZeros ( uint32 Value)
inlinestatic

Counts the number of leading zeros in the bit representation of the 32-bit value

Parameters
Valuethe value to determine the number of leading zeros for
Returns
the number of zeros before the first "on" bit

Definition at line 687 of file GenericPlatformMath.h.

◆ CountLeadingZeros64()

static FORCEINLINE uint64 FGenericPlatformMath::CountLeadingZeros64 ( uint64 Value)
inlinestatic

Counts the number of leading zeros in the bit representation of the 64-bit value

Parameters
Valuethe value to determine the number of leading zeros for
Returns
the number of zeros before the first "on" bit

Definition at line 700 of file GenericPlatformMath.h.

◆ CountLeadingZeros8()

static FORCEINLINE uint8 FGenericPlatformMath::CountLeadingZeros8 ( uint8 Value)
inlinestatic

Counts the number of leading zeros in the bit representation of the 8-bit value

Parameters
Valuethe value to determine the number of leading zeros for
Returns
the number of zeros before the first "on" bit

Definition at line 674 of file GenericPlatformMath.h.

◆ CountTrailingZeros()

static FORCEINLINE uint32 FGenericPlatformMath::CountTrailingZeros ( uint32 Value)
inlinestatic

Counts the number of trailing zeros in the bit representation of the value

Parameters
Valuethe value to determine the number of trailing zeros for
Returns
the number of zeros after the last "on" bit

Definition at line 713 of file GenericPlatformMath.h.

◆ CountTrailingZeros64()

static FORCEINLINE uint64 FGenericPlatformMath::CountTrailingZeros64 ( uint64 Value)
inlinestatic

Counts the number of trailing zeros in the bit representation of the value

Parameters
Valuethe value to determine the number of trailing zeros for
Returns
the number of zeros after the last "on" bit

Definition at line 735 of file GenericPlatformMath.h.

◆ Exp() [1/2]

static FORCEINLINE double FGenericPlatformMath::Exp ( double Value)
inlinestatic

Definition at line 481 of file GenericPlatformMath.h.

◆ Exp() [2/2]

static FORCEINLINE float FGenericPlatformMath::Exp ( float Value)
inlinestatic

Definition at line 480 of file GenericPlatformMath.h.

◆ Exp2() [1/2]

static FORCEINLINE double FGenericPlatformMath::Exp2 ( double Value)
inlinestatic

Definition at line 485 of file GenericPlatformMath.h.

◆ Exp2() [2/2]

static FORCEINLINE float FGenericPlatformMath::Exp2 ( float Value)
inlinestatic

Definition at line 484 of file GenericPlatformMath.h.

◆ FloatSelect() [1/2]

static CONSTEXPR FORCEINLINE double FGenericPlatformMath::FloatSelect ( double Comparand,
double ValueGEZero,
double ValueLTZero )
inlinestatic

Returns value based on comparand. The main purpose of this function is to avoid branching based on floating point comparison which can be avoided via compiler intrinsics.

Please note that we don't define what happens in the case of NaNs as there might be platform specific differences.

Parameters
ComparandComparand the results are based on
ValueGEZeroReturn value if Comparand >= 0
ValueLTZeroReturn value if Comparand < 0
Returns
ValueGEZero if Comparand >= 0, ValueLTZero otherwise

Definition at line 887 of file GenericPlatformMath.h.

◆ FloatSelect() [2/2]

static CONSTEXPR FORCEINLINE float FGenericPlatformMath::FloatSelect ( float Comparand,
float ValueGEZero,
float ValueLTZero )
inlinestatic

Returns value based on comparand. The main purpose of this function is to avoid branching based on floating point comparison which can be avoided via compiler intrinsics.

Please note that we don't define what happens in the case of NaNs as there might be platform specific differences.

Parameters
ComparandComparand the results are based on
ValueGEZeroReturn value if Comparand >= 0
ValueLTZeroReturn value if Comparand < 0
Returns
ValueGEZero if Comparand >= 0, ValueLTZero otherwise

Definition at line 868 of file GenericPlatformMath.h.

◆ FloorLog2()

static FORCEINLINE uint32 FGenericPlatformMath::FloorLog2 ( uint32 Value)
inlinestatic

Computes the base 2 logarithm for an integer value. The result is rounded down to the nearest integer.

Parameters
ValueThe value to compute the log of
Returns
Log2 of Value. 0 if Value is 0.

Definition at line 637 of file GenericPlatformMath.h.

◆ FloorLog2_64()

static FORCEINLINE uint64 FGenericPlatformMath::FloorLog2_64 ( uint64 Value)
inlinestatic

Computes the base 2 logarithm for a 64-bit value. The result is rounded down to the nearest integer.

Parameters
ValueThe value to compute the log of
Returns
Log2 of Value. 0 if Value is 0.

Definition at line 655 of file GenericPlatformMath.h.

◆ FloorToDouble()

static FORCEINLINE double FGenericPlatformMath::FloorToDouble ( double F)
inlinestatic

Converts a double to a less or equal integer.

Parameters
FFloating point value to convert
Returns
The nearest integer value to 'F'.

Definition at line 292 of file GenericPlatformMath.h.

◆ FloorToFloat() [1/2]

static FORCEINLINE double FGenericPlatformMath::FloorToFloat ( double F)
inlinestatic

Definition at line 297 of file GenericPlatformMath.h.

◆ FloorToFloat() [2/2]

static FORCEINLINE float FGenericPlatformMath::FloorToFloat ( float F)
inlinestatic

Converts a float to the nearest less or equal integer.

Parameters
FFloating point value to convert
Returns
An integer less or equal to 'F'.

Definition at line 282 of file GenericPlatformMath.h.

◆ FloorToInt() [1/2]

static FORCEINLINE int64 FGenericPlatformMath::FloorToInt ( double F)
inlinestatic

Definition at line 274 of file GenericPlatformMath.h.

◆ FloorToInt() [2/2]

static FORCEINLINE int32 FGenericPlatformMath::FloorToInt ( float F)
inlinestatic

Definition at line 273 of file GenericPlatformMath.h.

◆ FloorToInt32() [1/2]

static FORCEINLINE int32 FGenericPlatformMath::FloorToInt32 ( double F)
inlinestatic

Definition at line 260 of file GenericPlatformMath.h.

◆ FloorToInt32() [2/2]

static FORCEINLINE int32 FGenericPlatformMath::FloorToInt32 ( float F)
inlinestatic

Converts a float to a nearest less or equal integer.

Parameters
FFloating point value to convert
Returns
An integer less or equal to 'F'.

Definition at line 254 of file GenericPlatformMath.h.

◆ FloorToInt64()

static FORCEINLINE int64 FGenericPlatformMath::FloorToInt64 ( double F)
inlinestatic

Definition at line 266 of file GenericPlatformMath.h.

◆ Fmod() [1/2]

static FORCENOINLINE double FGenericPlatformMath::Fmod ( double X,
double Y )
static

◆ Fmod() [2/2]

static FORCENOINLINE float FGenericPlatformMath::Fmod ( float X,
float Y )
static

Returns the floating-point remainder of X / Y Warning: Always returns remainder toward 0, not toward the smaller multiple of Y. So for example Fmod(2.8f, 2) gives .8f as you would expect, however, Fmod(-2.8f, 2) gives -.8f, NOT 1.2f Use Floor instead when snapping positions that can be negative to a grid

This is forced to NOT inline so that divisions by constant Y does not get optimized in to an inverse scalar multiply, which is not consistent with the intent nor with the vectorized version.

◆ FmodReportError() [1/2]

static void FGenericPlatformMath::FmodReportError ( double X,
double Y )
staticprivate

◆ FmodReportError() [2/2]

static void FGenericPlatformMath::FmodReportError ( float X,
float Y )
staticprivate

Error reporting for Fmod. Not inlined to avoid compilation issues and avoid all the checks and error reporting at all callsites.

◆ Frac() [1/2]

static FORCEINLINE double FGenericPlatformMath::Frac ( double Value)
inlinestatic

Definition at line 452 of file GenericPlatformMath.h.

◆ Frac() [2/2]

static FORCEINLINE float FGenericPlatformMath::Frac ( float Value)
inlinestatic

Returns the fractional part of a float.

Parameters
ValueFloating point value to convert
Returns
A float between >=0 and < 1.

Definition at line 446 of file GenericPlatformMath.h.

◆ Fractional() [1/2]

static FORCEINLINE double FGenericPlatformMath::Fractional ( double Value)
inlinestatic

Definition at line 436 of file GenericPlatformMath.h.

◆ Fractional() [2/2]

static FORCEINLINE float FGenericPlatformMath::Fractional ( float Value)
inlinestatic

Returns signed fractional part of a float.

Parameters
ValueFloating point value to convert
Returns
A float between >=0 and < 1 for nonnegative input. A float between >= -1 and < 0 for negative input.

Definition at line 431 of file GenericPlatformMath.h.

◆ FRand()

static FORCEINLINE float FGenericPlatformMath::FRand ( )
inlinestatic

Returns a random float between 0 and 1, inclusive.

Definition at line 614 of file GenericPlatformMath.h.

◆ GetRandSeed()

static int32 FGenericPlatformMath::GetRandSeed ( )
static

Returns the current seed for SRand().

◆ InvSqrt() [1/2]

static FORCEINLINE double FGenericPlatformMath::InvSqrt ( double F)
inlinestatic

Definition at line 547 of file GenericPlatformMath.h.

◆ InvSqrt() [2/2]

static FORCEINLINE float FGenericPlatformMath::InvSqrt ( float F)
inlinestatic

Computes a fully accurate inverse square root

Definition at line 546 of file GenericPlatformMath.h.

◆ InvSqrtEst() [1/2]

static FORCEINLINE double FGenericPlatformMath::InvSqrtEst ( double F)
inlinestatic

Definition at line 551 of file GenericPlatformMath.h.

◆ InvSqrtEst() [2/2]

static FORCEINLINE float FGenericPlatformMath::InvSqrtEst ( float F)
inlinestatic

Computes a faster but less accurate inverse square root

Definition at line 550 of file GenericPlatformMath.h.

◆ IsFinite() [1/2]

static FORCEINLINE bool FGenericPlatformMath::IsFinite ( double A)
inlinestatic

Definition at line 568 of file GenericPlatformMath.h.

◆ IsFinite() [2/2]

static FORCEINLINE bool FGenericPlatformMath::IsFinite ( float A)
inlinestatic

Return true if value is finite (not NaN and not Infinity).

Definition at line 564 of file GenericPlatformMath.h.

◆ IsNaN() [1/2]

static FORCEINLINE bool FGenericPlatformMath::IsNaN ( double A)
inlinestatic

Definition at line 558 of file GenericPlatformMath.h.

◆ IsNaN() [2/2]

static FORCEINLINE bool FGenericPlatformMath::IsNaN ( float A)
inlinestatic

Return true if value is NaN (not a number).

Definition at line 554 of file GenericPlatformMath.h.

◆ IsNegative() [1/2]

static FORCEINLINE bool FGenericPlatformMath::IsNegative ( double A)
inlinestatic

Definition at line 602 of file GenericPlatformMath.h.

◆ IsNegative() [2/2]

static FORCEINLINE bool FGenericPlatformMath::IsNegative ( float A)
inlinestatic

Definition at line 596 of file GenericPlatformMath.h.

◆ IsNegativeDouble()

static FORCEINLINE bool FGenericPlatformMath::IsNegativeDouble ( double A)
inlinestatic

Definition at line 590 of file GenericPlatformMath.h.

◆ IsNegativeFloat()

static FORCEINLINE bool FGenericPlatformMath::IsNegativeFloat ( float A)
inlinestatic

Definition at line 584 of file GenericPlatformMath.h.

◆ IsNegativeOrNegativeZero() [1/2]

static FORCEINLINE bool FGenericPlatformMath::IsNegativeOrNegativeZero ( double A)
inlinestatic

Definition at line 578 of file GenericPlatformMath.h.

◆ IsNegativeOrNegativeZero() [2/2]

static FORCEINLINE bool FGenericPlatformMath::IsNegativeOrNegativeZero ( float A)
inlinestatic

Definition at line 573 of file GenericPlatformMath.h.

◆ LoadHalf()

static FORCEINLINE float FGenericPlatformMath::LoadHalf ( const uint16 * Ptr)
inlinestatic

Definition at line 31 of file GenericPlatformMath.h.

◆ Log2() [1/2]

static FORCEINLINE double FGenericPlatformMath::Log2 ( double Value)
inlinestatic

Definition at line 497 of file GenericPlatformMath.h.

◆ Log2() [2/2]

static FORCEINLINE float FGenericPlatformMath::Log2 ( float Value)
inlinestatic

Definition at line 495 of file GenericPlatformMath.h.

◆ Loge() [1/2]

static FORCEINLINE double FGenericPlatformMath::Loge ( double Value)
inlinestatic

Definition at line 488 of file GenericPlatformMath.h.

◆ Loge() [2/2]

static FORCEINLINE float FGenericPlatformMath::Loge ( float Value)
inlinestatic

Definition at line 487 of file GenericPlatformMath.h.

◆ LogX() [1/2]

static FORCEINLINE double FGenericPlatformMath::LogX ( double Base,
double Value )
inlinestatic

Definition at line 491 of file GenericPlatformMath.h.

◆ LogX() [2/2]

static FORCEINLINE float FGenericPlatformMath::LogX ( float Base,
float Value )
inlinestatic

Definition at line 490 of file GenericPlatformMath.h.

◆ Max() [1/4]

template<class T >
static CONSTEXPR FORCEINLINE T FGenericPlatformMath::Max ( const T A,
const T B )
inlinestatic

Returns higher value in a generic way

Definition at line 908 of file GenericPlatformMath.h.

◆ Max() [2/4]

template<class T >
static FORCEINLINE T FGenericPlatformMath::Max ( const TArray< T > & Values,
int32 * MaxIndex = NULL )
inlinestatic

Max of Array

Parameters
Arrayof templated type
Optionalpointer for returning the index of the maximum element, if multiple maximum elements the first index is returned
Returns
The max value found in the array or default value if the array was empty

Definition at line 972 of file GenericPlatformMath.h.

◆ Max() [3/4]

Definition at line 526 of file UnrealMathVectorCommon.h.

◆ Max() [4/4]

template<>
FORCEINLINE VectorRegister4Float FGenericPlatformMath::Max ( const VectorRegister4Float A,
const VectorRegister4Float B )

Returns the larger of the two values (operates on each component individually)

Definition at line 521 of file UnrealMathVectorCommon.h.

◆ Min() [1/4]

template<class T >
static CONSTEXPR FORCEINLINE T FGenericPlatformMath::Min ( const T A,
const T B )
inlinestatic

Returns lower value in a generic way

Definition at line 915 of file GenericPlatformMath.h.

◆ Min() [2/4]

template<class T >
static FORCEINLINE T FGenericPlatformMath::Min ( const TArray< T > & Values,
int32 * MinIndex = NULL )
inlinestatic

Min of Array

Parameters
Arrayof templated type
Optionalpointer for returning the index of the minimum element, if multiple minimum elements the first index is returned
Returns
The min value found in the array or default value if the array was empty

Definition at line 935 of file GenericPlatformMath.h.

◆ Min() [3/4]

Definition at line 515 of file UnrealMathVectorCommon.h.

◆ Min() [4/4]

template<>
FORCEINLINE VectorRegister4Float FGenericPlatformMath::Min ( const VectorRegister4Float A,
const VectorRegister4Float B )

Returns the smaller of the two values (operates on each component individually)

Definition at line 510 of file UnrealMathVectorCommon.h.

◆ MIX_FLOATS_2_ARGS() [1/2]

FGenericPlatformMath::MIX_FLOATS_2_ARGS ( Max )

◆ MIX_FLOATS_2_ARGS() [2/2]

FGenericPlatformMath::MIX_FLOATS_2_ARGS ( Min )

◆ MIX_SIGNED_INTS_2_ARGS_CONSTEXPR() [1/2]

FGenericPlatformMath::MIX_SIGNED_INTS_2_ARGS_CONSTEXPR ( Max )

◆ MIX_SIGNED_INTS_2_ARGS_CONSTEXPR() [2/2]

FGenericPlatformMath::MIX_SIGNED_INTS_2_ARGS_CONSTEXPR ( Min )

◆ Modf() [1/2]

static FORCEINLINE double FGenericPlatformMath::Modf ( const double InValue,
double * OutIntPart )
inlinestatic

Breaks the given value into an integral and a fractional part.

Parameters
InValueFloating point value to convert
OutIntPartFloating point value that receives the integral part of the number.
Returns
The fractional part of the number.

Definition at line 474 of file GenericPlatformMath.h.

◆ Modf() [2/2]

static FORCEINLINE float FGenericPlatformMath::Modf ( const float InValue,
float * OutIntPart )
inlinestatic

Breaks the given value into an integral and a fractional part.

Parameters
InValueFloating point value to convert
OutIntPartFloating point value that receives the integral part of the number.
Returns
The fractional part of the number.

Definition at line 463 of file GenericPlatformMath.h.

◆ MortonCode2()

static FORCEINLINE uint32 FGenericPlatformMath::MortonCode2 ( uint32 x)
inlinestatic

Spreads bits to every other.

Definition at line 789 of file GenericPlatformMath.h.

◆ MortonCode2_64()

static FORCEINLINE uint64 FGenericPlatformMath::MortonCode2_64 ( uint64 x)
inlinestatic

Definition at line 799 of file GenericPlatformMath.h.

◆ MortonCode3()

static FORCEINLINE uint32 FGenericPlatformMath::MortonCode3 ( uint32 x)
inlinestatic

Spreads bits to every 3rd.

Definition at line 833 of file GenericPlatformMath.h.

◆ Pow() [1/2]

static FORCEINLINE double FGenericPlatformMath::Pow ( double A,
double B )
inlinestatic

Definition at line 542 of file GenericPlatformMath.h.

◆ Pow() [2/2]

static FORCEINLINE float FGenericPlatformMath::Pow ( float A,
float B )
inlinestatic

Definition at line 541 of file GenericPlatformMath.h.

◆ Rand()

static FORCEINLINE int32 FGenericPlatformMath::Rand ( )
inlinestatic

Returns a random integer between 0 and RAND_MAX, inclusive

Definition at line 608 of file GenericPlatformMath.h.

◆ RandInit()

static FORCEINLINE void FGenericPlatformMath::RandInit ( int32 Seed)
inlinestatic

Seeds global random number functions Rand() and FRand()

Definition at line 611 of file GenericPlatformMath.h.

◆ RESOLVE_FLOAT_AMBIGUITY_2_ARGS() [1/4]

FGenericPlatformMath::RESOLVE_FLOAT_AMBIGUITY_2_ARGS ( Atan2 )

◆ RESOLVE_FLOAT_AMBIGUITY_2_ARGS() [2/4]

FGenericPlatformMath::RESOLVE_FLOAT_AMBIGUITY_2_ARGS ( Fmod )

◆ RESOLVE_FLOAT_AMBIGUITY_2_ARGS() [3/4]

FGenericPlatformMath::RESOLVE_FLOAT_AMBIGUITY_2_ARGS ( LogX )

◆ RESOLVE_FLOAT_AMBIGUITY_2_ARGS() [4/4]

FGenericPlatformMath::RESOLVE_FLOAT_AMBIGUITY_2_ARGS ( Pow )

◆ ReverseMortonCode2()

static FORCEINLINE uint32 FGenericPlatformMath::ReverseMortonCode2 ( uint32 x)
inlinestatic

Reverses MortonCode2. Compacts every other bit to the right.

Definition at line 811 of file GenericPlatformMath.h.

◆ ReverseMortonCode2_64()

static FORCEINLINE uint64 FGenericPlatformMath::ReverseMortonCode2_64 ( uint64 x)
inlinestatic

Definition at line 821 of file GenericPlatformMath.h.

◆ ReverseMortonCode3()

static FORCEINLINE uint32 FGenericPlatformMath::ReverseMortonCode3 ( uint32 x)
inlinestatic

Reverses MortonCode3. Compacts every 3rd bit to the right.

Definition at line 844 of file GenericPlatformMath.h.

◆ RoundToDouble()

static FORCEINLINE double FGenericPlatformMath::RoundToDouble ( double F)
inlinestatic

Converts a double to the nearest integer. Rounds up when the fraction is .5

Parameters
FFloating point value to convert
Returns
The nearest integer to 'F'.

Definition at line 338 of file GenericPlatformMath.h.

◆ RoundToFloat() [1/2]

static FORCEINLINE double FGenericPlatformMath::RoundToFloat ( double F)
inlinestatic

Definition at line 343 of file GenericPlatformMath.h.

◆ RoundToFloat() [2/2]

static FORCEINLINE float FGenericPlatformMath::RoundToFloat ( float F)
inlinestatic

Converts a float to the nearest integer. Rounds up when the fraction is .5

Parameters
FFloating point value to convert
Returns
The nearest integer to 'F'.

Definition at line 328 of file GenericPlatformMath.h.

◆ RoundToInt() [1/2]

static FORCEINLINE int64 FGenericPlatformMath::RoundToInt ( double F)
inlinestatic

Definition at line 321 of file GenericPlatformMath.h.

◆ RoundToInt() [2/2]

static FORCEINLINE int32 FGenericPlatformMath::RoundToInt ( float F)
inlinestatic

Definition at line 320 of file GenericPlatformMath.h.

◆ RoundToInt32() [1/2]

static FORCEINLINE int32 FGenericPlatformMath::RoundToInt32 ( double F)
inlinestatic

Definition at line 311 of file GenericPlatformMath.h.

◆ RoundToInt32() [2/2]

static FORCEINLINE int32 FGenericPlatformMath::RoundToInt32 ( float F)
inlinestatic

Converts a float to the nearest integer. Rounds up when the fraction is .5

Parameters
FFloating point value to convert
Returns
The nearest integer to 'F'.

Definition at line 307 of file GenericPlatformMath.h.

◆ RoundToInt64()

static FORCEINLINE int64 FGenericPlatformMath::RoundToInt64 ( double F)
inlinestatic

Definition at line 315 of file GenericPlatformMath.h.

◆ RoundToNearestTiesToEven()

static int64 FGenericPlatformMath::RoundToNearestTiesToEven ( double F)
inlinestatic

Converts a double to nearest int64 with ties rounding to nearest even May incur a performance penalty. Asserts on platforms that do not support this mode.

Parameters
FDouble precision floating point value to convert
Returns
The 64-bit integer closest to 'F', with ties going to the nearest even number

Definition at line 406 of file GenericPlatformMath.h.

◆ RoundUpToPowerOfTwo()

static FORCEINLINE uint32 FGenericPlatformMath::RoundUpToPowerOfTwo ( uint32 Arg)
inlinestatic
Returns
Rounds the given number up to the next highest power of two.

Definition at line 778 of file GenericPlatformMath.h.

◆ RoundUpToPowerOfTwo64()

static FORCEINLINE uint64 FGenericPlatformMath::RoundUpToPowerOfTwo64 ( uint64 V)
inlinestatic

Definition at line 783 of file GenericPlatformMath.h.

◆ Sign()

template<class T >
static CONSTEXPR FORCEINLINE T FGenericPlatformMath::Sign ( const T A)
inlinestatic

Returns 1, 0, or -1 depending on relation of T to 0

Definition at line 901 of file GenericPlatformMath.h.

◆ Sin() [1/2]

static FORCEINLINE double FGenericPlatformMath::Sin ( double Value)
inlinestatic

Definition at line 514 of file GenericPlatformMath.h.

◆ Sin() [2/2]

static FORCEINLINE float FGenericPlatformMath::Sin ( float Value)
inlinestatic

Definition at line 513 of file GenericPlatformMath.h.

◆ Sinh() [1/2]

static FORCEINLINE double FGenericPlatformMath::Sinh ( double Value)
inlinestatic

Definition at line 520 of file GenericPlatformMath.h.

◆ Sinh() [2/2]

static FORCEINLINE float FGenericPlatformMath::Sinh ( float Value)
inlinestatic

Definition at line 519 of file GenericPlatformMath.h.

◆ Sqrt() [1/2]

static FORCEINLINE double FGenericPlatformMath::Sqrt ( double Value)
inlinestatic

Definition at line 539 of file GenericPlatformMath.h.

◆ Sqrt() [2/2]

static FORCEINLINE float FGenericPlatformMath::Sqrt ( float Value)
inlinestatic

Definition at line 538 of file GenericPlatformMath.h.

◆ SRand()

static float FGenericPlatformMath::SRand ( )
static

Returns a seeded random float in the range [0,1), using the seed from SRandInit().

◆ SRandInit()

static void FGenericPlatformMath::SRandInit ( int32 Seed)
static

Seeds future calls to SRand()

◆ StoreHalf()

static FORCEINLINE void FGenericPlatformMath::StoreHalf ( uint16 * Ptr,
float Value )
inlinestatic

Definition at line 65 of file GenericPlatformMath.h.

◆ Tan() [1/2]

static FORCEINLINE double FGenericPlatformMath::Tan ( double Value)
inlinestatic

Definition at line 529 of file GenericPlatformMath.h.

◆ Tan() [2/2]

static FORCEINLINE float FGenericPlatformMath::Tan ( float Value)
inlinestatic

Definition at line 528 of file GenericPlatformMath.h.

◆ TruncToDouble()

static FORCEINLINE double FGenericPlatformMath::TruncToDouble ( double F)
inlinestatic

Converts a double to an integer value with truncation towards zero.

Parameters
FFloating point value to convert
Returns
Truncated integer value.

Definition at line 239 of file GenericPlatformMath.h.

◆ TruncToFloat() [1/2]

static FORCEINLINE double FGenericPlatformMath::TruncToFloat ( double F)
inlinestatic

Definition at line 244 of file GenericPlatformMath.h.

◆ TruncToFloat() [2/2]

static FORCEINLINE float FGenericPlatformMath::TruncToFloat ( float F)
inlinestatic

Converts a float to an integer value with truncation towards zero.

Parameters
FFloating point value to convert
Returns
Truncated integer value.

Definition at line 229 of file GenericPlatformMath.h.

◆ TruncToInt() [1/2]

static CONSTEXPR FORCEINLINE int64 FGenericPlatformMath::TruncToInt ( double F)
inlinestatic

Definition at line 222 of file GenericPlatformMath.h.

◆ TruncToInt() [2/2]

static CONSTEXPR FORCEINLINE int32 FGenericPlatformMath::TruncToInt ( float F)
inlinestatic

Definition at line 221 of file GenericPlatformMath.h.

◆ TruncToInt32() [1/2]

static CONSTEXPR FORCEINLINE int32 FGenericPlatformMath::TruncToInt32 ( double F)
inlinestatic

Definition at line 212 of file GenericPlatformMath.h.

◆ TruncToInt32() [2/2]

static CONSTEXPR FORCEINLINE int32 FGenericPlatformMath::TruncToInt32 ( float F)
inlinestatic

Converts a float to an integer with truncation towards zero.

Parameters
FFloating point value to convert
Returns
Truncated integer.

Definition at line 208 of file GenericPlatformMath.h.

◆ TruncToInt64()

static CONSTEXPR FORCEINLINE int64 FGenericPlatformMath::TruncToInt64 ( double F)
inlinestatic

Definition at line 216 of file GenericPlatformMath.h.

◆ VectorLoadHalf()

static FORCEINLINE void FGenericPlatformMath::VectorLoadHalf ( float *RESTRICT Dst,
const uint16 *RESTRICT Src )
inlinestatic

Definition at line 122 of file GenericPlatformMath.h.

◆ VectorStoreHalf()

static FORCEINLINE void FGenericPlatformMath::VectorStoreHalf ( uint16 *RESTRICT Dst,
const float *RESTRICT Src )
inlinestatic

Definition at line 130 of file GenericPlatformMath.h.

◆ WideVectorLoadHalf()

static FORCEINLINE void FGenericPlatformMath::WideVectorLoadHalf ( float *RESTRICT Dst,
const uint16 *RESTRICT Src )
inlinestatic

Definition at line 138 of file GenericPlatformMath.h.

◆ WideVectorStoreHalf()

static FORCEINLINE void FGenericPlatformMath::WideVectorStoreHalf ( uint16 *RESTRICT Dst,
const float *RESTRICT Src )
inlinestatic

Definition at line 144 of file GenericPlatformMath.h.


The documentation for this struct was generated from the following files: