Skip to content

Commit

Permalink
Update SourcePawn.
Browse files Browse the repository at this point in the history
This updates float.inc and smn_float.cpp to compensate for alias
removal.
  • Loading branch information
dvander committed Nov 4, 2023
1 parent 060c832 commit 7bfd5e5
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 18 deletions.
5 changes: 5 additions & 0 deletions core/logic/smn_float.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,11 @@ REGISTER_NATIVES(floatnatives)
{"RoundToCeil", sm_RoundToCeil},
{"RoundToFloor", sm_RoundToFloor},
{"RoundToNearest", sm_RoundToNearest},
{"__FLOAT_MUL__", sm_FloatMul},
{"__FLOAT_DIV__", sm_FloatDiv},
{"__FLOAT_ADD__", sm_FloatAdd},
{"__FLOAT_SUB__", sm_FloatSub},
{"__FLOAT_MOD__", sm_FloatMod},
{"__FLOAT_GT__", sm_FloatGt},
{"__FLOAT_GE__", sm_FloatGe},
{"__FLOAT_LT__", sm_FloatLt},
Expand Down
34 changes: 17 additions & 17 deletions plugins/include/float.inc
Original file line number Diff line number Diff line change
Expand Up @@ -277,11 +277,11 @@ stock int RoundFloat(float value)
#if !defined __sourcepawn2__
// Internal aliases for backwards compatibility.
native float __FLOAT_MUL__(float a, float b) = FloatMul;
native float __FLOAT_DIV__(float a, float b) = FloatDiv;
native float __FLOAT_ADD__(float a, float b) = FloatAdd;
native float __FLOAT_SUB__(float a, float b) = FloatSub;
native float __FLOAT_MOD__(float a, float b) = FloatMod;
native float __FLOAT_MUL__(float a, float b);
native float __FLOAT_DIV__(float a, float b);
native float __FLOAT_ADD__(float a, float b);
native float __FLOAT_SUB__(float a, float b);
native float __FLOAT_MOD__(float a, float b);
native bool __FLOAT_GT__(float a, float b);
native bool __FLOAT_GE__(float a, float b);
Expand All @@ -291,18 +291,18 @@ native bool __FLOAT_EQ__(float a, float b);
native bool __FLOAT_NE__(float a, float b);
native bool __FLOAT_NOT__(float a);
native float operator*(float oper1, float oper2) = FloatMul;
native float operator/(float oper1, float oper2) = FloatDiv;
native float operator+(float oper1, float oper2) = FloatAdd;
native float operator-(float oper1, float oper2) = FloatSub;
native float operator%(float oper1, float oper2) = FloatMod;
native bool operator!(float oper1) = __FLOAT_NOT__;
native bool operator>(float oper1, float oper2) = __FLOAT_GT__;
native bool operator>=(float oper1, float oper2) = __FLOAT_GE__;
native bool operator<(float oper1, float oper2) = __FLOAT_LT__;
native bool operator<=(float oper1, float oper2) = __FLOAT_LE__;
native bool operator!=(float oper1, float oper2) = __FLOAT_NE__;
native bool operator==(float oper1, float oper2) = __FLOAT_EQ__;
stock float operator*(float oper1, float oper2) { return __FLOAT_MUL__(oper1, oper2); }
stock float operator/(float oper1, float oper2) { return __FLOAT_DIV__(oper1, oper2); }
stock float operator+(float oper1, float oper2) { return __FLOAT_ADD__(oper1, oper2); }
stock float operator-(float oper1, float oper2) { return __FLOAT_SUB__(oper1, oper2); }
stock float operator%(float oper1, float oper2) { return __FLOAT_MOD__(oper1, oper2); }
stock bool operator!(float oper1) { return __FLOAT_NOT__(oper1); }
stock bool operator>(float oper1, float oper2) { return __FLOAT_GT__(oper1, oper2); }
stock bool operator>=(float oper1, float oper2) { return __FLOAT_GE__(oper1, oper2); }
stock bool operator<(float oper1, float oper2) { return __FLOAT_LT__(oper1, oper2); }
stock bool operator<=(float oper1, float oper2) { return __FLOAT_LE__(oper1, oper2); }
stock bool operator!=(float oper1, float oper2) { return __FLOAT_NE__(oper1, oper2); }
stock bool operator==(float oper1, float oper2) { return __FLOAT_EQ__(oper1, oper2); }
stock float operator++(float oper)
{
Expand Down

0 comments on commit 7bfd5e5

Please sign in to comment.