In standard programming, bitwise operators are something that a lot of programmers use and can take for granted. In Command Programming, this is much harder to implement. The idea is that the bitwise operators, & (bitwise and), | (bitwise or), ^ (bitwise exclusive or), << (bitwise shift left), and >> (bitwise logical shift right) would work well with the scoreboard players operation command, as well as the unary ~ (bitwise not/inversion) operator. The addition of unary ~ is a "would be nice", as it would require adding a new (unary) syntax for scoreboard players operation, and bitwise not is equivalent to bitwise xor with -1 (since java is 2s compliment, and these bitwise operations would be implemented directly in java, right?).
Example Usage
scoreboard players set Reg register_acc 15
scoreboard players set Reg register_accb 10
scoreboard players operation Reg register_acc ^= register_accb
Puts 5 in Reg#register_acc (Fancy notation I use for the score of register_acc for Reg)
The unary syntax could be
scoreboard players operator ~ Reg register_acc
Which from the previous case, would put -6 in Reg#register_acc, because 2s compliment
If unary sytanx will be added, the unary - (negation) operation would also be nice. (again its trivial to do on its own).
In standard programming, bitwise operators are something that a lot of programmers use and can take for granted. In Command Programming, this is much harder to implement. The idea is that the bitwise operators, & (bitwise and), | (bitwise or), ^ (bitwise exclusive or), << (bitwise shift left), and >> (bitwise logical shift right) would work well with the scoreboard players operation command, as well as the unary ~ (bitwise not/inversion) operator. The addition of unary ~ is a "would be nice", as it would require adding a new (unary) syntax for scoreboard players operation, and bitwise not is equivalent to bitwise xor with -1 (since java is 2s compliment, and these bitwise operations would be implemented directly in java, right?).
Example Usage