mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-01 23:58:20 +00:00
Fold the children of | as conditions when | is folded as condition.
This commit is contained in:
parent
a6a16c6e8f
commit
8d337467cb
1 changed files with 5 additions and 0 deletions
|
@ -245,6 +245,11 @@ class foldconst(object):
|
||||||
self.FoldCond(parent, index, ParentIsNegation)
|
self.FoldCond(parent, index, ParentIsNegation)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if nt == '|':
|
||||||
|
# In FoldCond(a | b), both a and b are conds themselves.
|
||||||
|
self.FoldCond(child, 0)
|
||||||
|
self.FoldCond(child, 1)
|
||||||
|
|
||||||
# Specific optimization to catch a bitwise test appearing frequently.
|
# Specific optimization to catch a bitwise test appearing frequently.
|
||||||
# If b and c are nonzero constant powers of two:
|
# If b and c are nonzero constant powers of two:
|
||||||
# !(a & b) | !(a & c) -> ~(a|~(b|c))
|
# !(a & b) | !(a & c) -> ~(a|~(b|c))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue