mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-01 15:48:21 +00:00
Extend an optimization to cover some (admittedly rare) cases.
The value of bool|const is const when bit 0 of const is 1. This is a generalization of the case bool|1 = 1.
This commit is contained in:
parent
141301d7ff
commit
c9f73bd429
1 changed files with 2 additions and 2 deletions
|
@ -1363,11 +1363,11 @@ class foldconst(object):
|
|||
return
|
||||
if (nt == '|'
|
||||
and (val == -1
|
||||
or val == 1 and self.IsBool(child[a]))
|
||||
or (val & 1) == 1 and self.IsBool(child[a]))
|
||||
or nt == '&' and val == 0
|
||||
):
|
||||
# a|-1 -> -1 if a is SEF
|
||||
# a|1 -> 1 if a is bool and SEF
|
||||
# a|C -> C if bit 0 of C is 1 and a is bool and SEF
|
||||
# a&0 -> 0 if a is SEF
|
||||
if child[a].SEF:
|
||||
parent[index] = child[b]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue