// this script was compiled with wurst 1.8.1.0-jenkins-Wurst-1366 globals integer bitset_add_return_val=0 endglobals native testFail takes string msg returns nothing native testSuccess takes nothing returns nothing function initGlobals takes nothing returns nothing endfunction function bitset_containsPow takes integer this_val, integer pow returns boolean return ModuloInteger(this_val, pow * 2) >= pow endfunction function int_pow takes integer this, integer x returns integer local integer result = 1 local integer i = 1 loop exitwhen i > x set result = result * this set i = i + 1 endloop return result endfunction function bitset_add takes integer this_val, integer v returns integer set v = int_pow(2, v) if not bitset_containsPow(this_val, v) then set this_val = this_val + v endif set bitset_add_return_val = this_val return bitset_add_return_val endfunction function init_Test takes nothing returns nothing local integer tuple_temp = bitset_add(5, 1) if tuple_temp == 7 then call testSuccess() else call testFail(I2S(tuple_temp)) endif endfunction function main takes nothing returns nothing call initGlobals() call init_Test() endfunction function config takes nothing returns nothing endfunction