Floating point utility routines
Files | |
file | csqint.h |
Quick floating point to integer conversions. | |
Functions | |
static long | csQfixed16 (float n) |
Quickly convert a floating-point number to 16.16 fixed-point value. | |
static long | csQfixed24 (float n) |
Quickly convert a floating-point number to 8.24 fixed-point value. | |
static long | csQfixed8 (float n) |
Quickly convert a floating-point number to 24.8 fixed-point value. | |
template<typename T> | |
static long | csQint (T n) |
Quickly truncate the fractional part of a floating-point value and convert it to a long integer using processor and/or number format quirks if available. | |
static float | csQisqrt (float x) |
This routine is basically equivalent to csQsqrt() except that it returns 1/sqrt(x) rather than the proper square root. | |
template<typename T> | |
static long | csQround (T n) |
Quickly round a floating-point value and convert it to a long integer using processor and/or number format quirks if available. | |
static float | csQsqrt (float x) |
This routine computes sqrt(x) very quickly on Intel and PowerPC platforms. |
Function Documentation
static inline long csQfixed16 | ( | float | n | ) | [inline, static] |
Quickly convert a floating-point number to 16.16 fixed-point value.
Definition at line 54 of file csqint.h.
Referenced by csQint16(), csG2DDrawLine< Tpixel, Tpixmixer >::DrawLine(), and csFixed16::operator=().
static inline long csQfixed24 | ( | float | n | ) | [inline, static] |
Quickly convert a floating-point number to 8.24 fixed-point value.
Definition at line 59 of file csqint.h.
Referenced by csQint24(), and csFixed24::operator=().
static inline long csQfixed8 | ( | float | n | ) | [inline, static] |
static long csQint | ( | T | n | ) | [inline, static] |
Quickly truncate the fractional part of a floating-point value and convert it to a long integer using processor and/or number format quirks if available.
Definition at line 36 of file csqint.h.
Referenced by csG2DDrawLine< Tpixel, Tpixmixer >::DrawLine().
static float csQisqrt | ( | float | x | ) | [static] |
This routine is basically equivalent to csQsqrt() except that it returns 1/sqrt(x) rather than the proper square root.
It should be used anywhere you need the inverse root (in 3D graphics it is a common situation), because the routine is a little faster than csQsqrt() and also you avoid a division.
Definition at line 98 of file csqsqrt.h.
Referenced by csVector4T< float >::Normalize().
static long csQround | ( | T | n | ) | [inline, static] |
static float csQsqrt | ( | float | x | ) | [static] |
This routine computes sqrt(x) very quickly on Intel and PowerPC platforms.
Definition at line 97 of file csqsqrt.h.
Referenced by csQuaternion::Norm(), csSpotLightProc< AttenuationProc >::PerVertex::PerVertex(), csDirectionalLightProc< AttenuationProc >::PerVertex::PerVertex(), and csPointLightProc< AttenuationProc >::PerVertex::PerVertex().
Generated for Crystal Space by doxygen 1.4.7