Closed armoha closed 2 years ago
Python (and other languages too?) does not have in-place bitwise not operator, but in-place not is special case of constant xor: ~A = A ^ -1
Related: https://stackoverflow.com/questions/20916404/python-in-place-complement-operator
Added ixor, ilshift, irshift by https://github.com/armoha/eudplib/commit/2c0ebd9b4b6ba99bb9ea411c41e29a806cb4ece2
Implemented for variables (EUDVariable, EUDLightVariable).
Should we expose these api for plain memory address? Or postpone it and rather focus on epScript compiler optimization?
Mostly resolved and implemented by series of commits, released since euddraft 0.9.5.1
:
^=
, <<=
, >>=
: armoha/eudplib@2c0ebd9b4b6ba99bb9ea411c41e29a806cb4ece2
&=
, |=
: armoha/eudplib@3b3368062cb71b92807588743394ca35b413e0e4 , armoha/eudplib@2ee72cf8a7fce86a2063dfdbf5dcadecf68a0877
armoha/eudplib@e6d22884762e18ef044ff232bc7baf31cc2da30e
armoha/eudplib@2a947b069dbedc02decbc8015199bc77a9802d21
&
, |
, ^
, ~
, -
: armoha/eudplib@f385a83dee3cff34f6f991ac7f56b2f85fdb77de
armoha/eudplib@9a9c89b8545c6d4d7f5990dad5c66f50ea7f334f
<<
: armoha/eudplib@07c76e6c061bde36f4ffb836c82969cc2ff056eb
armoha/eudplib@78872f945b83ef0b3de2f8b573c484087b31aa4c
armoha/eudplib@d834c38142b42d755c97355d8b40b4abe0f1b6c8
Further optimization on other types or simple memory address would be better implemented as compiler optimization.
See https://github.com/heinermann/llvm-bw/wiki/Instruction-Implementation
Implement followings:
A = ~A
-> 2A - Add 0xFFFFFFFF with mask b101010..., add 0xFFFFFFFF with mask b010101...A = -A
-> 3A - Same as bitwise not with extra +1.A ^= Constant
-> 2A - Add constant with mask b01010101, add constant again with mask b10101010.A ^= Constant
-> 2A - Add ~constant with mask b01010101, add ~constant again with mask b10101010.Revise these:
A ^= B
-> 3T10A