Ark Server API (ASE) - Wiki
|
#include <GenericPlatformMath.h>
Public Member Functions | |
template<> | |
FORCEINLINE float | Abs (const float A) |
Static Public Member Functions | |
static CONSTEXPR FORCEINLINE int32 | TruncToInt (float F) |
static CONSTEXPR FORCEINLINE float | TruncToFloat (float F) |
static FORCEINLINE int32 | FloorToInt (float F) |
static FORCEINLINE float | FloorToFloat (float F) |
static FORCEINLINE double | FloorToDouble (double F) |
static FORCEINLINE int32 | RoundToInt (float F) |
static FORCEINLINE float | RoundToFloat (float F) |
static FORCEINLINE double | RoundToDouble (double F) |
static FORCEINLINE int32 | CeilToInt (float F) |
static FORCEINLINE float | CeilToFloat (float F) |
static FORCEINLINE double | CeilToDouble (double F) |
static FORCEINLINE float | Fractional (float Value) |
static FORCEINLINE float | Frac (float 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 float | Exp2 (float Value) |
static FORCEINLINE float | Loge (float Value) |
static FORCEINLINE float | LogX (float Base, float Value) |
static FORCEINLINE float | Log2 (float Value) |
static FORCEINLINE float | Fmod (float X, float Y) |
static FORCEINLINE float | Sin (float Value) |
static FORCEINLINE float | Asin (float Value) |
static FORCEINLINE float | Sinh (float Value) |
static FORCEINLINE float | Cos (float Value) |
static FORCEINLINE float | Acos (float Value) |
static FORCEINLINE float | Tan (float Value) |
static FORCEINLINE float | Atan (float Value) |
static FORCEINLINE float | Sqrt (float Value) |
static FORCEINLINE float | Pow (float A, float B) |
static FORCEINLINE float | InvSqrt (float F) |
static FORCEINLINE float | InvSqrtEst (float F) |
static FORCEINLINE bool | IsNaN (float A) |
static FORCEINLINE bool | IsFinite (float A) |
static FORCEINLINE bool | IsNegativeFloat (const float &A) |
static FORCEINLINE bool | IsNegativeDouble (const double &A) |
static FORCEINLINE int32 | Rand () |
static FORCEINLINE void | RandInit (int32 Seed) |
static FORCEINLINE float | FRand () |
static FORCEINLINE uint32 | FloorLog2 (uint32 Value) |
static FORCEINLINE uint64 | FloorLog2_64 (uint64 Value) |
static FORCEINLINE uint32 | CountLeadingZeros (uint32 Value) |
static FORCEINLINE uint64 | CountLeadingZeros64 (uint64 Value) |
static FORCEINLINE uint32 | CountTrailingZeros (uint32 Value) |
static FORCEINLINE uint32 | CeilLogTwo (uint32 Arg) |
static FORCEINLINE uint64 | CeilLogTwo64 (uint64 Arg) |
static FORCEINLINE uint32 | RoundUpToPowerOfTwo (uint32 Arg) |
static FORCEINLINE uint32 | MortonCode2 (uint32 x) |
static FORCEINLINE uint32 | ReverseMortonCode2 (uint32 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) |
Generic implementation for most platforms
Definition at line 23 of file GenericPlatformMath.h.
FORCEINLINE float FGenericPlatformMath::Abs | ( | const float | A | ) |
Float specialization
Definition at line 621 of file GenericPlatformMath.h.
|
inlinestatic |
Computes absolute value in a generic way
Definition at line 509 of file GenericPlatformMath.h.
|
inlinestatic |
|
inlinestatic |
Definition at line 213 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 218 of file GenericPlatformMath.h.
Returns smallest N such that (1<<N)>=Arg. Note: CeilLogTwo(0)=0 because (1<<0)=1 >= 0.
Definition at line 407 of file GenericPlatformMath.h.
|
inlinestatic |
Converts a double to the nearest greater or equal integer.
F | Floating point value to convert |
Definition at line 130 of file GenericPlatformMath.h.
|
inlinestatic |
Converts a float to the nearest greater or equal integer.
F | Floating point value to convert |
Definition at line 120 of file GenericPlatformMath.h.
|
inlinestatic |
Converts a float to the nearest greater or equal integer.
F | Floating point value to convert |
Definition at line 110 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 609 of file GenericPlatformMath.h.
Counts the number of leading zeros in the bit representation of the value
Value | the value to determine the number of leading zeros for |
Definition at line 362 of file GenericPlatformMath.h.
Counts the number of leading zeros in the bit representation of the 64-bit value
Value | the value to determine the number of leading zeros for |
Definition at line 375 of file GenericPlatformMath.h.
Counts the number of trailing zeros in the bit representation of the value
Value | the value to determine the number of trailing zeros for |
Definition at line 388 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 178 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 180 of file GenericPlatformMath.h.
|
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.
Comparand | Comparand the results are based on |
ValueGEZero | Return value if Comparand >= 0 |
ValueLTZero | Return value if Comparand < 0 |
Definition at line 502 of file GenericPlatformMath.h.
|
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.
Comparand | Comparand the results are based on |
ValueGEZero | Return value if Comparand >= 0 |
ValueLTZero | Return value if Comparand < 0 |
Definition at line 483 of file GenericPlatformMath.h.
Computes the base 2 logarithm for an integer value that is greater than 0. The result is rounded down to the nearest integer.
Value | The value to compute the log of |
Definition at line 270 of file GenericPlatformMath.h.
Computes the base 2 logarithm for a 64-bit value that is greater than 0. The result is rounded down to the nearest integer.
Value | The value to compute the log of |
Definition at line 343 of file GenericPlatformMath.h.
|
inlinestatic |
Converts a double to a less or equal integer.
F | Floating point value to convert |
Definition at line 70 of file GenericPlatformMath.h.
|
inlinestatic |
Converts a float to the nearest less or equal integer.
F | Floating point value to convert |
Definition at line 60 of file GenericPlatformMath.h.
|
inlinestatic |
Converts a float to a nearest less or equal integer.
F | Floating point value to convert |
Definition at line 50 of file GenericPlatformMath.h.
|
inlinestatic |
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
Definition at line 192 of file GenericPlatformMath.h.
|
inlinestatic |
Returns the fractional part of a float.
Value | Floating point value to convert |
Definition at line 150 of file GenericPlatformMath.h.
|
inlinestatic |
Returns signed fractional part of a float.
Value | Floating point value to convert |
Definition at line 140 of file GenericPlatformMath.h.
|
inlinestatic |
Returns a random float between 0 and 1, inclusive.
Definition at line 261 of file GenericPlatformMath.h.
|
inlinestatic |
Computes a fully accurate inverse square root
Definition at line 223 of file GenericPlatformMath.h.
|
inlinestatic |
Computes a faster but less accurate inverse square root
Definition at line 229 of file GenericPlatformMath.h.
|
inlinestatic |
Return true if value is finite (not NaN and not Infinity).
Definition at line 240 of file GenericPlatformMath.h.
|
inlinestatic |
Return true if value is NaN (not a number).
Definition at line 235 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 249 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 244 of file GenericPlatformMath.h.
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
Returns higher value in a generic way
Definition at line 523 of file GenericPlatformMath.h.
|
inlinestatic |
Max of Array
Array | of templated type |
Optional | pointer for returning the index of the maximum element, if multiple maximum elements the first index is returned |
Definition at line 579 of file GenericPlatformMath.h.
|
inlinestatic |
Returns lower value in a generic way
Definition at line 530 of file GenericPlatformMath.h.
|
inlinestatic |
Min of Array
Array | of templated type |
Optional | pointer for returning the index of the minimum element, if multiple minimum elements the first index is returned |
Definition at line 542 of file GenericPlatformMath.h.
|
inlinestatic |
Breaks the given value into an integral and a fractional part.
InValue | Floating point value to convert |
OutIntPart | Floating point value that receives the integral part of the number. |
Definition at line 172 of file GenericPlatformMath.h.
|
inlinestatic |
Breaks the given value into an integral and a fractional part.
InValue | Floating point value to convert |
OutIntPart | Floating point value that receives the integral part of the number. |
Definition at line 161 of file GenericPlatformMath.h.
Spreads bits to every other.
Definition at line 426 of file GenericPlatformMath.h.
Spreads bits to every 3rd.
Definition at line 448 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 220 of file GenericPlatformMath.h.
|
inlinestatic |
Returns a random integer between 0 and RAND_MAX, inclusive
Definition at line 255 of file GenericPlatformMath.h.
|
inlinestatic |
Seeds global random number functions Rand() and FRand()
Definition at line 258 of file GenericPlatformMath.h.
Reverses MortonCode2. Compacts every other bit to the right.
Definition at line 437 of file GenericPlatformMath.h.
Reverses MortonCode3. Compacts every 3rd bit to the right.
Definition at line 459 of file GenericPlatformMath.h.
|
inlinestatic |
Converts a double to the nearest integer. Rounds up when the fraction is .5
F | Floating point value to convert |
Definition at line 100 of file GenericPlatformMath.h.
|
inlinestatic |
Converts a float to the nearest integer. Rounds up when the fraction is .5
F | Floating point value to convert |
Definition at line 90 of file GenericPlatformMath.h.
|
inlinestatic |
Converts a float to the nearest integer. Rounds up when the fraction is .5
F | Floating point value to convert |
Definition at line 80 of file GenericPlatformMath.h.
Definition at line 420 of file GenericPlatformMath.h.
|
inlinestatic |
Returns 1, 0, or -1 depending on relation of T to 0
Definition at line 516 of file GenericPlatformMath.h.
|
inlinestatic |
|
inlinestatic |
Definition at line 214 of file GenericPlatformMath.h.
|
inlinestatic |
|
inlinestatic |
Definition at line 217 of file GenericPlatformMath.h.
|
inlinestatic |
Converts a float to an integer value with truncation towards zero.
F | Floating point value to convert |
Definition at line 40 of file GenericPlatformMath.h.
Converts a float to an integer with truncation towards zero.
F | Floating point value to convert |
Definition at line 30 of file GenericPlatformMath.h.