mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-01 23:58:20 +00:00
Simplify operands of bitwise OR expressions as booleans. Deals with a TODO in a more general way.
This commit is contained in:
parent
6813bb0458
commit
de33c2df01
1 changed files with 4 additions and 1 deletions
|
@ -128,7 +128,10 @@ class foldconst(object):
|
|||
self.FoldTree(parent, index)
|
||||
|
||||
if nt == '|':
|
||||
#TODO: simplify !!a|b or a|!!b -> a|b
|
||||
# In a boolean context, the operands count as booleans.
|
||||
self.FoldCond(child, 0)
|
||||
self.FoldCond(child, 1)
|
||||
|
||||
a, b = 0, 1
|
||||
if child[a]['nt'] == 'CONST':
|
||||
a, b = 1, 0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue