engine
 
载入中...
搜索中...
未找到
Public 成员函数 | 静态 Public 成员函数 | 所有成员列表
FGenericPlatformMath结构体 参考

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

成员函数说明

◆ CeilLogTwo()

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

Returns smallest N such that (1<<N)>=Arg.

Note: CeilLogTwo(0)=0 because (1<<0)=1 >= 0.

◆ CeilToDouble()

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

Converts a double to the nearest greater or equal integer.

参数
FFloating point value to convert
返回
An integer greater or equal to 'F'.

◆ CeilToFloat()

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

Converts a float to the nearest greater or equal integer.

参数
FFloating point value to convert
返回
An integer greater or equal to 'F'.

◆ CeilToInt()

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

Converts a float to the nearest greater or equal integer.

参数
FFloating point value to convert
返回
An integer greater or equal to 'F'.

◆ CountLeadingZeros()

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

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

参数
Valuethe value to determine the number of leading zeros for
返回
the number of zeros before the first "on" bit

◆ CountLeadingZeros64()

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

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

参数
Valuethe value to determine the number of leading zeros for
返回
the number of zeros before the first "on" bit

◆ CountLeadingZeros8()

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

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

参数
Valuethe value to determine the number of leading zeros for
返回
the number of zeros before the first "on" bit

◆ CountTrailingZeros()

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

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

参数
Valuethe value to determine the number of trailing zeros for
返回
the number of zeros after the last "on" bit

◆ CountTrailingZeros64()

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

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

参数
Valuethe value to determine the number of trailing zeros for
返回
the number of zeros after the last "on" bit

◆ 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.

参数
ComparandComparand the results are based on
ValueGEZeroReturn value if Comparand >= 0
ValueLTZeroReturn value if Comparand < 0
返回
ValueGEZero if Comparand >= 0, ValueLTZero otherwise

◆ 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.

参数
ComparandComparand the results are based on
ValueGEZeroReturn value if Comparand >= 0
ValueLTZeroReturn value if Comparand < 0
返回
ValueGEZero if Comparand >= 0, ValueLTZero otherwise

◆ FloorLog2()

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

Computes the base 2 logarithm for an integer value that is greater than 0.

The result is rounded down to the nearest integer.

参数
ValueThe value to compute the log of
返回
Log2 of Value. 0 if Value is 0.

◆ FloorLog2_64()

static FORCEINLINE uint64 FGenericPlatformMath::FloorLog2_64 ( uint64  Value)
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.

参数
ValueThe value to compute the log of
返回
Log2 of Value. 0 if Value is 0.

◆ FloorToDouble()

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

Converts a double to a less or equal integer.

参数
FFloating point value to convert
返回
The nearest integer value to 'F'.

◆ FloorToFloat()

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

Converts a float to the nearest less or equal integer.

参数
FFloating point value to convert
返回
An integer less or equal to 'F'.

◆ FloorToInt()

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

Converts a float to a nearest less or equal integer.

参数
FFloating point value to convert
返回
An integer less or equal to 'F'.

◆ Fmod()

static CORE_API 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.

◆ Frac()

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

Returns the fractional part of a float.

参数
ValueFloating point value to convert
返回
A float between >=0 and < 1.

◆ Fractional()

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

Returns signed fractional part of a float.

参数
ValueFloating point value to convert
返回
A float between >=0 and < 1 for nonnegative input. A float between >= -1 and < 0 for negative input.

◆ Max()

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

Max of Array

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

◆ Min()

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

Min of Array

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

◆ 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.

参数
InValueFloating point value to convert
OutIntPartFloating point value that receives the integral part of the number.
返回
The fractional part of the number.

◆ 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.

参数
InValueFloating point value to convert
OutIntPartFloating point value that receives the integral part of the number.
返回
The fractional part of the number.

◆ ReverseMortonCode2()

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

Reverses MortonCode2.

Compacts every other bit to the right.

◆ ReverseMortonCode3()

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

Reverses MortonCode3.

Compacts every 3rd bit to the right.

◆ RoundToDouble()

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

Converts a double to the nearest integer.

Rounds up when the fraction is .5

参数
FFloating point value to convert
返回
The nearest integer to 'F'.

◆ RoundToFloat()

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

Converts a float to the nearest integer.

Rounds up when the fraction is .5

参数
FFloating point value to convert
返回
The nearest integer to 'F'.

◆ RoundToInt()

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

Converts a float to the nearest integer.

Rounds up when the fraction is .5

参数
FFloating point value to convert
返回
The nearest integer to 'F'.

◆ RoundUpToPowerOfTwo()

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

◆ TruncToDouble()

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

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

参数
FFloating point value to convert
返回
Truncated integer value.

◆ TruncToFloat()

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

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

参数
FFloating point value to convert
返回
Truncated integer value.

◆ TruncToInt()

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

Converts a float to an integer with truncation towards zero.

参数
FFloating point value to convert
返回
Truncated integer.

该结构体的文档由以下文件生成: