diff options
author | Jesusaves <cpntb1@ymail.com> | 2021-05-22 21:23:39 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2021-05-22 21:23:39 -0300 |
commit | 496ba5b71e48d9cc62fa34f415390c077bf27716 (patch) | |
tree | 04693bfee86fbe846694f75f4da3f7513fb36d21 /npc/functions/math.txt | |
parent | ce0d133a465f2a09d09aa1640dd16bc3d32adad9 (diff) | |
download | serverdata-496ba5b71e48d9cc62fa34f415390c077bf27716.tar.gz serverdata-496ba5b71e48d9cc62fa34f415390c077bf27716.tar.bz2 serverdata-496ba5b71e48d9cc62fa34f415390c077bf27716.tar.xz serverdata-496ba5b71e48d9cc62fa34f415390c077bf27716.zip |
Add bitwise functions from TMW rEvolt
Diffstat (limited to 'npc/functions/math.txt')
-rw-r--r-- | npc/functions/math.txt | 19 |
1 files changed, 0 insertions, 19 deletions
diff --git a/npc/functions/math.txt b/npc/functions/math.txt index 9c93fbb74..fc27bec40 100644 --- a/npc/functions/math.txt +++ b/npc/functions/math.txt @@ -102,22 +102,3 @@ function script ponderate_avg { return (.@h1+.@h2)/.@dd; } -// bitmask_count(<int>) -// returns the number of bits set in <int> (max. 4096) - -function script bitmask_count { - .@n = getarg(0); // Number evaluated - .@p=0; // Bits set/unset - .@s=0; // Stack and Check - .@m=0; // Memory - - // Loop only as needed - while (.@s < .@n) { - .@s=2**.@m; - if (.@n & .@s) - .@p++; - .@m++; - } - return .@p; -} - |