Warcraft III resources & community, 2003–2006 · archived

BitwiseNot

not rated
Submitted by Aiursrage2kVariable Change0 downloads
Bitwise Not. Requires CountBits function.

Source

function BitwiseNot takes integer val returns integer 
  local integer i = 0 
  local integer retval = 0 
  local integer max = CountBits(val)

  loop 
     exitwhen i > max
     if ModuloInteger(val,2) == 0 then
       set retval = retval + R2I(Pow(2,i)) 
     endif
     set val = val / 2
     set i = i + 1
  endloop 

  return retval 
endfunction

Comments

0

No comments.