Generic implementation for most platforms 更多...
#include <GenericPlatformMath.h>
类 FGenericPlatformMath 继承关系图:Public 成员函数 | |
| template<> | |
| FORCEINLINE float | Abs (const float A) |
| Float specialization | |
| template<> | |
| FORCEINLINE VectorRegister | Max (const VectorRegister A, const VectorRegister B) |
| Returns the larger of the two values (operates on each component individually) | |
| template<> | |
| FORCEINLINE VectorRegister | Min (const VectorRegister A, const VectorRegister B) |
| Returns the smaller of the two values (operates on each component individually) | |
静态 Public 成员函数 | |
| template<class T > | |
| static CONSTEXPR FORCEINLINE T | Abs (const T A) |
| Computes absolute value in a generic way | |
| static FORCEINLINE uint32 | CeilLogTwo (uint32 Arg) |
| Returns smallest N such that (1<<N)>=Arg. 更多... | |
| static FORCEINLINE double | CeilToDouble (double F) |
| Converts a double to the nearest greater or equal integer. 更多... | |
| static FORCEINLINE float | CeilToFloat (float F) |
| Converts a float to the nearest greater or equal integer. 更多... | |
| static FORCEINLINE int32 | CeilToInt (float F) |
| Converts a float to the nearest greater or equal integer. 更多... | |
| static FORCEINLINE uint32 | CountLeadingZeros (uint32 Value) |
| Counts the number of leading zeros in the bit representation of the 32-bit value 更多... | |
| static FORCEINLINE uint64 | CountLeadingZeros64 (uint64 Value) |
| Counts the number of leading zeros in the bit representation of the 64-bit value 更多... | |
| static FORCEINLINE uint8 | CountLeadingZeros8 (uint8 Value) |
| Counts the number of leading zeros in the bit representation of the 8-bit value 更多... | |
| static FORCEINLINE uint32 | CountTrailingZeros (uint32 Value) |
| Counts the number of trailing zeros in the bit representation of the value 更多... | |
| static FORCEINLINE uint64 | CountTrailingZeros64 (uint64 Value) |
| Counts the number of trailing zeros in the bit representation of the value 更多... | |
| static CONSTEXPR FORCEINLINE double | FloatSelect (double Comparand, double ValueGEZero, double ValueLTZero) |
| Returns value based on comparand. 更多... | |
| static CONSTEXPR FORCEINLINE float | FloatSelect (float Comparand, float ValueGEZero, float ValueLTZero) |
| Returns value based on comparand. 更多... | |
| static FORCEINLINE uint32 | FloorLog2 (uint32 Value) |
| Computes the base 2 logarithm for an integer value that is greater than 0. 更多... | |
| static FORCEINLINE uint64 | FloorLog2_64 (uint64 Value) |
| Computes the base 2 logarithm for a 64-bit value that is greater than 0. 更多... | |
| static FORCEINLINE double | FloorToDouble (double F) |
| Converts a double to a less or equal integer. 更多... | |
| static FORCEINLINE float | FloorToFloat (float F) |
| Converts a float to the nearest less or equal integer. 更多... | |
| static FORCEINLINE int32 | FloorToInt (float F) |
| Converts a float to a nearest less or equal integer. 更多... | |
| static CORE_API FORCENOINLINE float | Fmod (float X, float Y) |
| Returns the floating-point remainder of X / Y Warning: Always returns remainder toward 0, not toward the smaller multiple of Y. 更多... | |
| static FORCEINLINE float | Frac (float Value) |
| Returns the fractional part of a float. 更多... | |
| static FORCEINLINE float | Fractional (float Value) |
| Returns signed fractional part of a float. 更多... | |
| static FORCEINLINE float | FRand () |
| Returns a random float between 0 and 1, inclusive. | |
| static CORE_API int32 | GetRandSeed () |
| Returns the current seed for SRand(). | |
| static FORCEINLINE float | InvSqrt (float F) |
| Computes a fully accurate inverse square root | |
| static FORCEINLINE float | InvSqrtEst (float F) |
| Computes a faster but less accurate inverse square root | |
| static FORCEINLINE bool | IsFinite (float A) |
| Return true if value is finite (not NaN and not Infinity). | |
| static FORCEINLINE bool | IsNaN (float A) |
| Return true if value is NaN (not a number). | |
| template<class T > | |
| static CONSTEXPR FORCEINLINE T | Max (const T A, const T B) |
| Returns higher value in a generic way | |
| template<class T > | |
| static FORCEINLINE T | Max (const TArray< T > &Values, int32 *MaxIndex=NULL) |
| Max of Array 更多... | |
| template<class T > | |
| static CONSTEXPR FORCEINLINE T | Min (const T A, const T B) |
| Returns lower value in a generic way | |
| template<class T > | |
| static FORCEINLINE T | Min (const TArray< T > &Values, int32 *MinIndex=NULL) |
| Min of Array 更多... | |
| static FORCEINLINE double | Modf (const double InValue, double *OutIntPart) |
| Breaks the given value into an integral and a fractional part. 更多... | |
| static FORCEINLINE float | Modf (const float InValue, float *OutIntPart) |
| Breaks the given value into an integral and a fractional part. 更多... | |
| static FORCEINLINE uint32 | MortonCode2 (uint32 x) |
| Spreads bits to every other. | |
| static FORCEINLINE uint32 | MortonCode3 (uint32 x) |
| Spreads bits to every 3rd. | |
| static FORCEINLINE int32 | Rand () |
| Returns a random integer between 0 and RAND_MAX, inclusive | |
| static FORCEINLINE void | RandInit (int32 Seed) |
| Seeds global random number functions Rand() and FRand() | |
| static FORCEINLINE uint32 | ReverseMortonCode2 (uint32 x) |
| Reverses MortonCode2. 更多... | |
| static FORCEINLINE uint32 | ReverseMortonCode3 (uint32 x) |
| Reverses MortonCode3. 更多... | |
| static FORCEINLINE double | RoundToDouble (double F) |
| Converts a double to the nearest integer. 更多... | |
| static FORCEINLINE float | RoundToFloat (float F) |
| Converts a float to the nearest integer. 更多... | |
| static FORCEINLINE int32 | RoundToInt (float F) |
| Converts a float to the nearest integer. 更多... | |
| static FORCEINLINE uint32 | RoundUpToPowerOfTwo (uint32 Arg) |
| template<class T > | |
| static CONSTEXPR FORCEINLINE T | Sign (const T A) |
| Returns 1, 0, or -1 depending on relation of T to 0 | |
| static CORE_API float | SRand () |
| Returns a seeded random float in the range [0,1), using the seed from SRandInit(). | |
| static CORE_API void | SRandInit (int32 Seed) |
| Seeds future calls to SRand() | |
| static FORCEINLINE double | TruncToDouble (double F) |
| Converts a double to an integer value with truncation towards zero. 更多... | |
| static FORCEINLINE float | TruncToFloat (float F) |
| Converts a float to an integer value with truncation towards zero. 更多... | |
| static CONSTEXPR FORCEINLINE int32 | TruncToInt (float F) |
| Converts a float to an integer with truncation towards zero. 更多... | |
Generic implementation for most platforms
|
inlinestatic |
Returns smallest N such that (1<<N)>=Arg.
Note: CeilLogTwo(0)=0 because (1<<0)=1 >= 0.
|
inlinestatic |
Converts a double to the nearest greater or equal integer.
| F | Floating point value to convert |
|
inlinestatic |
Converts a float to the nearest greater or equal integer.
| F | Floating point value to convert |
|
inlinestatic |
Converts a float to the nearest greater or equal integer.
| F | Floating point value to convert |
|
inlinestatic |
Counts the number of leading zeros in the bit representation of the 32-bit value
| Value | the value to determine the number of leading zeros for |
|
inlinestatic |
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 |
|
inlinestatic |
Counts the number of leading zeros in the bit representation of the 8-bit value
| Value | the value to determine the number of leading zeros for |
|
inlinestatic |
Counts the number of trailing zeros in the bit representation of the value
| Value | the value to determine the number of trailing zeros for |
|
inlinestatic |
Counts the number of trailing zeros in the bit representation of the value
| Value | the value to determine the number of trailing zeros for |
|
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 |
|
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 |
|
inlinestatic |
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 |
|
inlinestatic |
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 |
|
inlinestatic |
Converts a double to a less or equal integer.
| F | Floating point value to convert |
|
inlinestatic |
Converts a float to the nearest less or equal integer.
| F | Floating point value to convert |
|
inlinestatic |
Converts a float to a nearest less or equal integer.
| F | Floating point value to convert |
|
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.
|
inlinestatic |
Returns the fractional part of a float.
| Value | Floating point value to convert |
|
inlinestatic |
Returns signed fractional part of a float.
| Value | Floating point value to convert |
|
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 |
|
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 |
|
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. |
|
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. |
|
inlinestatic |
Reverses MortonCode2.
Compacts every other bit to the right.
|
inlinestatic |
Reverses MortonCode3.
Compacts every 3rd bit to the right.
|
inlinestatic |
Converts a double to the nearest integer.
Rounds up when the fraction is .5
| F | Floating point value to convert |
|
inlinestatic |
Converts a float to the nearest integer.
Rounds up when the fraction is .5
| F | Floating point value to convert |
|
inlinestatic |
Converts a float to the nearest integer.
Rounds up when the fraction is .5
| F | Floating point value to convert |
|
inlinestatic |
|
inlinestatic |
Converts a double to an integer value with truncation towards zero.
| F | Floating point value to convert |
|
inlinestatic |
Converts a float to an integer value with truncation towards zero.
| F | Floating point value to convert |
|
inlinestatic |
Converts a float to an integer with truncation towards zero.
| F | Floating point value to convert |