taro icon indicating copy to clipboard operation
taro copied to clipboard

Add bitwise operations to make creation of bitfields possible

Open IJN-Yamato opened this issue 4 years ago • 2 comments
trafficstars

Add:

  • bitwise AND (& operator)
  • bitwise OR (| opeator)
  • bitwise XOR (^ operator)
  • bitwise left shift (<< operator)
  • bitwise right shift (>> operator)
  • bitwise unsigned right shift (>>> operator)
  • bitwise inversion (~value) unknown unknown

IJN-Yamato avatar Mar 01 '21 10:03 IJN-Yamato

what's the point of this PR? is there a problem that needs to be solved?

m0dE avatar Mar 27 '21 01:03 m0dE

Yes, it's to make "more or less advanced" creators avoid using more than 5, 10 (or maybe even 15) boolean or number variables (used in a way to serve the same purpose as boolean) both globally and as unit variables, which not only makes quite a mess in the editor, but as well makes the variables part, depending on where the variable "chunk" has been assigned, more difficult to maintain. Using bitfields can solve that as you can test one numeric value against certain bits and check if the result is larger than 0, which makes that numeric variable easily behave as a boolean value array.

ghost avatar Mar 27 '21 06:03 ghost