Ark Server API (ASA) - Wiki
|
#include <GenericPlatformMath.h>
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 Private Member Functions | |
static void | FmodReportError (float X, float Y) |
static void | FmodReportError (double X, double Y) |
Generic implementation for most platforms
Definition at line 27 of file GenericPlatformMath.h.
FORCEINLINE double FGenericPlatformMath::Abs | ( | const double | A | ) |
Definition at line 1030 of file GenericPlatformMath.h.
FORCEINLINE float FGenericPlatformMath::Abs | ( | const float | A | ) |
Float specialization
Definition at line 1025 of file GenericPlatformMath.h.
Computes absolute value in a generic way
Definition at line 894 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 526 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 525 of file GenericPlatformMath.h.
Performs a bit cast of the given unsigned int to float of the same bit width.
U | The 32-bit unsigned int to bit cast to a 32-bit float. |
Definition at line 181 of file GenericPlatformMath.h.
Performs a bit cast of the given unsigned int to float of the same bit width.
U | The 64-bit unsigned int to bit cast to a 64-bit float. |
Definition at line 194 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 517 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 516 of file GenericPlatformMath.h.
Performs a bit cast of the given double to an unsigned int of the same bit width.
D | The double to bit cast to an unsigned integer. |
Definition at line 168 of file GenericPlatformMath.h.
Performs a bit cast of the given float to an unsigned int of the same bit width.
F | The float to bit cast to an unsigned integer. |
Definition at line 155 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 532 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 531 of file GenericPlatformMath.h.
|
inlinestatic |
Returns smallest N such that (1<<N)>=Arg. Note: CeilLogTwo(0)=0
Definition at line 754 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 761 of file GenericPlatformMath.h.
|
inlinestatic |
Converts a double to the nearest greater or equal integer.
F | Floating point value to convert |
Definition at line 390 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 395 of file GenericPlatformMath.h.
|
inlinestatic |
Converts a float to the nearest greater or equal integer.
F | Floating point value to convert |
Definition at line 380 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 373 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 372 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 359 of file GenericPlatformMath.h.
|
inlinestatic |
Converts a float to the nearest greater or equal integer.
F | Floating point value to convert |
Definition at line 353 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 365 of file GenericPlatformMath.h.
|
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.
|
inlinestatic |
Definition at line 523 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 522 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 1002 of file GenericPlatformMath.h.
|
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 |
Definition at line 687 of file GenericPlatformMath.h.
|
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 |
Definition at line 700 of file GenericPlatformMath.h.
|
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 |
Definition at line 674 of file GenericPlatformMath.h.
|
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 |
Definition at line 713 of file GenericPlatformMath.h.
|
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 |
Definition at line 735 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 481 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 480 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 485 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 484 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 887 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 868 of file GenericPlatformMath.h.
|
inlinestatic |
Computes the base 2 logarithm for an integer value. The result is rounded down to the nearest integer.
Value | The value to compute the log of |
Definition at line 637 of file GenericPlatformMath.h.
|
inlinestatic |
Computes the base 2 logarithm for a 64-bit value. The result is rounded down to the nearest integer.
Value | The value to compute the log of |
Definition at line 655 of file GenericPlatformMath.h.
|
inlinestatic |
Converts a double to a less or equal integer.
F | Floating point value to convert |
Definition at line 292 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 297 of file GenericPlatformMath.h.
|
inlinestatic |
Converts a float to the nearest less or equal integer.
F | Floating point value to convert |
Definition at line 282 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 274 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 273 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 260 of file GenericPlatformMath.h.
|
inlinestatic |
Converts a float to a nearest less or equal integer.
F | Floating point value to convert |
Definition at line 254 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 266 of file GenericPlatformMath.h.
|
static |
|
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.
Error reporting for Fmod. Not inlined to avoid compilation issues and avoid all the checks and error reporting at all callsites.
|
inlinestatic |
Definition at line 452 of file GenericPlatformMath.h.
|
inlinestatic |
Returns the fractional part of a float.
Value | Floating point value to convert |
Definition at line 446 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 436 of file GenericPlatformMath.h.
|
inlinestatic |
Returns signed fractional part of a float.
Value | Floating point value to convert |
Definition at line 431 of file GenericPlatformMath.h.
|
inlinestatic |
Returns a random float between 0 and 1, inclusive.
Definition at line 614 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 547 of file GenericPlatformMath.h.
|
inlinestatic |
Computes a fully accurate inverse square root
Definition at line 546 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 551 of file GenericPlatformMath.h.
|
inlinestatic |
Computes a faster but less accurate inverse square root
Definition at line 550 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 568 of file GenericPlatformMath.h.
|
inlinestatic |
Return true if value is finite (not NaN and not Infinity).
Definition at line 564 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 558 of file GenericPlatformMath.h.
|
inlinestatic |
Return true if value is NaN (not a number).
Definition at line 554 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 602 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 596 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 590 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 584 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 578 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 573 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 31 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 497 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 495 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 488 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 487 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 491 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 490 of file GenericPlatformMath.h.
Returns higher value in a generic way
Definition at line 908 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 972 of file GenericPlatformMath.h.
FORCEINLINE VectorRegister4Double FGenericPlatformMath::Max | ( | const VectorRegister4Double | A, |
const VectorRegister4Double | B ) |
Definition at line 526 of file UnrealMathVectorCommon.h.
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.
Returns lower value in a generic way
Definition at line 915 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 935 of file GenericPlatformMath.h.
FORCEINLINE VectorRegister4Double FGenericPlatformMath::Min | ( | const VectorRegister4Double | A, |
const VectorRegister4Double | B ) |
Definition at line 515 of file UnrealMathVectorCommon.h.
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.
FGenericPlatformMath::MIX_FLOATS_2_ARGS | ( | Max | ) |
FGenericPlatformMath::MIX_FLOATS_2_ARGS | ( | Min | ) |
FGenericPlatformMath::MIX_SIGNED_INTS_2_ARGS_CONSTEXPR | ( | Max | ) |
FGenericPlatformMath::MIX_SIGNED_INTS_2_ARGS_CONSTEXPR | ( | Min | ) |
|
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 474 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 463 of file GenericPlatformMath.h.
|
inlinestatic |
Spreads bits to every other.
Definition at line 789 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 799 of file GenericPlatformMath.h.
|
inlinestatic |
Spreads bits to every 3rd.
Definition at line 833 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 542 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 541 of file GenericPlatformMath.h.
|
inlinestatic |
Returns a random integer between 0 and RAND_MAX, inclusive
Definition at line 608 of file GenericPlatformMath.h.
|
inlinestatic |
Seeds global random number functions Rand() and FRand()
Definition at line 611 of file GenericPlatformMath.h.
FGenericPlatformMath::RESOLVE_FLOAT_AMBIGUITY_2_ARGS | ( | Atan2 | ) |
FGenericPlatformMath::RESOLVE_FLOAT_AMBIGUITY_2_ARGS | ( | Fmod | ) |
FGenericPlatformMath::RESOLVE_FLOAT_AMBIGUITY_2_ARGS | ( | LogX | ) |
FGenericPlatformMath::RESOLVE_FLOAT_AMBIGUITY_2_ARGS | ( | Pow | ) |
|
inlinestatic |
Reverses MortonCode2. Compacts every other bit to the right.
Definition at line 811 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 821 of file GenericPlatformMath.h.
|
inlinestatic |
Reverses MortonCode3. Compacts every 3rd bit to the right.
Definition at line 844 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 338 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 343 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 328 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 321 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 320 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 311 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 307 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 315 of file GenericPlatformMath.h.
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.
F | Double precision floating point value to convert |
Definition at line 406 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 778 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 783 of file GenericPlatformMath.h.
Returns 1, 0, or -1 depending on relation of T to 0
Definition at line 901 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 514 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 513 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 520 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 519 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 539 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 538 of file GenericPlatformMath.h.
Returns a seeded random float in the range [0,1), using the seed from SRandInit().
|
inlinestatic |
Definition at line 65 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 529 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 528 of file GenericPlatformMath.h.
|
inlinestatic |
Converts a double to an integer value with truncation towards zero.
F | Floating point value to convert |
Definition at line 239 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 244 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 229 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 222 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 221 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 212 of file GenericPlatformMath.h.
|
inlinestatic |
Converts a float to an integer with truncation towards zero.
F | Floating point value to convert |
Definition at line 208 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 216 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 122 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 130 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 138 of file GenericPlatformMath.h.
|
inlinestatic |
Definition at line 144 of file GenericPlatformMath.h.