From 496ba5b71e48d9cc62fa34f415390c077bf27716 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Sat, 22 May 2021 21:23:39 -0300 Subject: Add bitwise functions from TMW rEvolt --- npc/functions/math.txt | 19 ------------------- 1 file changed, 19 deletions(-) (limited to 'npc/functions/math.txt') 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() -// returns the number of bits set in (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; -} - -- cgit v1.2.3-60-g2f50