The Vector3 functions where not really const, since they operated on pointers.

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1706 4a71c877-e1ca-e34f-864e-861f7616d084
master
Dennis Schridde 2007-05-26 17:00:55 +00:00
parent 4d96fb962d
commit 2313b8d53e
3 changed files with 8 additions and 12 deletions

View File

@ -182,9 +182,7 @@
/*!
* \def WZ_DECL_PURE
* This function works read only on its arguments or global variables.
* The result of a call will not change between two consecutive calls.
* Helps optimization.
* "Many functions have no effects except the return value and their return value depends only on the parameters and/or global variables. Such a function can be subject to common subexpression elimination and loop optimization just as an arithmetic operator would be."
*/
#if defined(WZ_CC_GNU) && !defined(WZ_CC_INTEL) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2))
# define WZ_DECL_PURE __attribute__((__pure__))
@ -195,9 +193,7 @@
/*!
* \def WZ_DECL_CONST
* This function works read only on its arguments and nothing else.
* The result of a call will not change between two consecutive calls.
* Helps optimization.
* "Many functions do not examine any values except their arguments, and have no effects except the return value. Basically this is just slightly more strict class than the pure attribute below, since function is not allowed to read global memory."
*/
#if defined(WZ_CC_GNU) && !defined(WZ_CC_INTEL) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2))
# define WZ_DECL_CONST __attribute__((__const__))

View File

@ -10,7 +10,7 @@ typedef struct { float x, y, z; } Vector3f;
* \param[out] v Vector to set
* \param[in] x,y,z Values to set to
*/
WZ_DECL_CONST static inline void Vector3f_Set(Vector3f* v, const float x, const float y, const float z)
static inline void Vector3f_Set(Vector3f* v, const float x, const float y, const float z)
{
v->x = x;
v->y = y;
@ -24,7 +24,7 @@ WZ_DECL_CONST static inline void Vector3f_Set(Vector3f* v, const float x, const
* \param[out] v Vector to set
* \param[in] x,y,z Values to set to
*/
WZ_DECL_CONST static inline void Vector3i_Set(Vector3i *v, const int x, const int y, const int z)
static inline void Vector3i_Set(Vector3i *v, const int x, const int y, const int z)
{
v->x = x;
v->y = y;
@ -37,7 +37,7 @@ WZ_DECL_CONST static inline void Vector3i_Set(Vector3i *v, const int x, const in
* \param[out] dest Result
* \param[in] op1,op2 Operands
*/
WZ_DECL_CONST static inline void Vector3f_Sub(Vector3f* dest, const Vector3f* op1, const Vector3f* op2)
static inline void Vector3f_Sub(Vector3f* dest, const Vector3f* op1, const Vector3f* op2)
{
dest->x = op1->x - op2->x;
dest->y = op1->y - op2->y;
@ -50,7 +50,7 @@ WZ_DECL_CONST static inline void Vector3f_Sub(Vector3f* dest, const Vector3f* op
* \param[in] op1,op2 Operands
* \return Scalarproduct of the 2 vectors
*/
WZ_DECL_CONST static inline float Vector3f_SP(const Vector3f* op1, const Vector3f* op2)
static inline float Vector3f_SP(const Vector3f* op1, const Vector3f* op2)
{
return op1->x * op2->x + op1->y * op2->y + op1->z * op2->z;
}
@ -61,7 +61,7 @@ WZ_DECL_CONST static inline float Vector3f_SP(const Vector3f* op1, const Vector3
* \param[out] dest Result
* \param[in] op1,op2 Operands
*/
WZ_DECL_CONST static inline void Vector3f_CP(Vector3f* dest, const Vector3f* op1, const Vector3f* op2)
static inline void Vector3f_CP(Vector3f* dest, const Vector3f* op1, const Vector3f* op2)
{
dest->x = op1->y * op2->z - op1->z * op2->y;
dest->y = op1->z * op2->x - op1->x * op2->z;

View File

@ -33,7 +33,7 @@ extern BOOL gameInitialised;
extern BOOL frontendInitialised;
extern BOOL bDisableLobby;
extern WZ_DECL_PURE GS_GAMEMODE GetGameMode(void);
extern GS_GAMEMODE GetGameMode(void) WZ_DECL_PURE;
extern void SetGameMode(GS_GAMEMODE status);
extern char SaveGamePath[];