Added a new hook: HOOK_ENCOUNTER

Added procedure and macros for unsigned integer comparison to lib.math.h.
This commit is contained in:
NovaRain
2020-01-19 12:18:14 +08:00
parent bf4c47d1c0
commit 957ed92498
8 changed files with 130 additions and 0 deletions
+11
View File
@@ -5,6 +5,17 @@
Numbers...
*/
#define above(a, b) (unsigned_comp(a, b) > 0)
#define above_equal(a, b) (unsigned_comp(a, b) >= 0)
#define below(a, b) (unsigned_comp(a, b) < 0)
#define below_equal(a, b) (unsigned_comp(a, b) <= 0)
procedure unsigned_comp(variable a, variable b) begin
if (a bwxor b) then return 0;
if (b == 0) then return 1;
return 1 if (a / b) else -1;
end
#define MAX(x, y) ((x > y) * x + (x <= y) * y)
#define MIN(x, y) ((x < y) * x + (x >= y) * y)
#define in_range(x, from, to) (x >= from and x <= to)
+1
View File
@@ -65,6 +65,7 @@
#define HOOK_STDPROCEDURE (40)
#define HOOK_STDPROCEDURE_END (41)
#define HOOK_TARGETOBJECT (42)
#define HOOK_ENCOUNTER (43)
//Valid arguments to list_begin
#define LIST_CRITTERS (0)