mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-01 23:58:20 +00:00
Save a comparison (fixes a FIXME)
This commit is contained in:
parent
0808938894
commit
e88e39127b
1 changed files with 19 additions and 19 deletions
|
@ -1347,8 +1347,6 @@ class foldconst(object):
|
|||
node.ch = [child[a]]
|
||||
return
|
||||
|
||||
#FIXME: Could remove one comparison
|
||||
if nt == '&&' or nt == '||':
|
||||
if nt == '||':
|
||||
# Expand to its equivalent a || b -> !!(a | b)
|
||||
node = nr(nt='|', t='integer', ch=[child[0], child[1]],
|
||||
|
@ -1356,10 +1354,13 @@ class foldconst(object):
|
|||
node = nr(nt='!', t='integer', ch=[node], SEF=node.SEF)
|
||||
node = nr(nt='!', t='integer', ch=[node], SEF=node.SEF)
|
||||
parent[index] = node
|
||||
else:
|
||||
# Make another pass with the substitution
|
||||
self.FoldTree(parent, index)
|
||||
elif nt == '&&':
|
||||
# Expand to its equivalent a && b -> !(!a | !b)
|
||||
orchildren = [
|
||||
nr(nt='!',t='integer',ch=[child[0]],SEF=child[0].SEF),
|
||||
nr(nt='!',t='integer',ch=[child[1]],SEF=child[1].SEF)
|
||||
nr(nt='!', t='integer', ch=[child[0]], SEF=child[0].SEF),
|
||||
nr(nt='!', t='integer', ch=[child[1]], SEF=child[1].SEF)
|
||||
]
|
||||
node = nr(nt='|', t='integer', ch=orchildren,
|
||||
SEF=child[0].SEF and child[1].SEF)
|
||||
|
@ -1367,7 +1368,6 @@ class foldconst(object):
|
|||
parent[index] = node
|
||||
# Make another pass with the substitution
|
||||
self.FoldTree(parent, index)
|
||||
return
|
||||
|
||||
return
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue