@@ -97,6 +97,19 @@ native float FloatAdd(float oper1, float oper2);
97
97
#pragma deprecated This native is internal implementation. For subtraction use the ' -' operator.
98
98
native float FloatSub (float oper1, float oper2);
99
99
100
+ /* *
101
+ * Returns the modulus of oper1 and oper2.
102
+ *
103
+ * Note: This native is internal implementation. For modulo use the '%' operator.
104
+ *
105
+ * @param oper1 First value.
106
+ * @param oper2 Second value.
107
+ * @return oper1%oper2.
108
+ * @deprecated This native is internal implementation. For modulo use the '%' operator.
109
+ */
110
+ #pragma deprecated This native is internal implementation. For modulo use the ' %' operator.
111
+ native float FloatMod (float oper1, float oper2);
112
+
100
113
/* *
101
114
* Returns the decimal part of a float.
102
115
*
@@ -269,6 +282,7 @@ native float __FLOAT_MUL__(float a, float b) = FloatMul;
269
282
native float __FLOAT_DIV__ (float a, float b) = FloatDiv;
270
283
native float __FLOAT_ADD__ (float a, float b) = FloatAdd;
271
284
native float __FLOAT_SUB__ (float a, float b) = FloatSub;
285
+ native float __FLOAT_MOD__ (float a, float b) = FloatMod;
272
286
273
287
native bool __FLOAT_GT__ (float a, float b);
274
288
native bool __FLOAT_GE__ (float a, float b);
@@ -282,6 +296,7 @@ native float operator*(float oper1, float oper2) = FloatMul;
282
296
native float operator/ (float oper1, float oper2) = FloatDiv;
283
297
native float operator+ (float oper1, float oper2) = FloatAdd;
284
298
native float operator- (float oper1, float oper2) = FloatSub;
299
+ native float operator% (float oper1, float oper2) = FloatMod;
285
300
native bool operator! (float oper1) = __FLOAT_NOT__;
286
301
native bool operator> (float oper1, float oper2) = __FLOAT_GT__;
287
302
native bool operator>= (float oper1, float oper2) = __FLOAT_GE__;
@@ -387,12 +402,15 @@ stock bool operator<=(int oper1, float oper2)
387
402
return __FLOAT_LE__ (float (oper1), oper2);
388
403
}
389
404
390
- /* *
391
- * Forbidden operators.
392
- */
393
- forward float operator% (float oper1, float oper2);
394
- forward float operator% (float oper1, int oper2);
395
- forward float operator% (int oper1, float oper2);
405
+ stock float operator% (float oper1, int oper2)
406
+ {
407
+ return __FLOAT_MOD__ (oper1, float (oper2));
408
+ }
409
+
410
+ stock float operator% (int oper1, float oper2)
411
+ {
412
+ return __FLOAT_MOD__ (float (oper1), oper2);
413
+ }
396
414
#endif // __sourcepawn2__
397
415
398
416
# define FLOAT_PI 3 .1415926535897932384626433832795
0 commit comments