From e8fb659592af9fd50a5e9ebf40d452a4c4d58b5a Mon Sep 17 00:00:00 2001 From: Sei Lisa Date: Wed, 18 Oct 2017 00:04:35 +0200 Subject: [PATCH] Allow -2147483648 to count as a power of 2 in an optimization. A case we oversought when implementing absorption of more than two flag tests into a single number. --- lslopt/lslfoldconst.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lslopt/lslfoldconst.py b/lslopt/lslfoldconst.py index 99939ec..f648c79 100644 --- a/lslopt/lslfoldconst.py +++ b/lslopt/lslfoldconst.py @@ -379,7 +379,8 @@ class foldconst(object): ch1 = child[a]['ch'][0]['ch'] ch2 = child[b]['ch'][0]['ch'] if (ch1[d]['nt'] == 'CONST' and ch2[f]['nt'] == 'CONST' - and (ch2[f]['value'] & (ch2[f]['value'] - 1)) == 0 + and (ch2[f]['value'] & (ch2[f]['value'] - 1) + & 0xFFFFFFFF) == 0 ): if self.CompareTrees(ch1[c], ch2[e]): # We're in that case. Apply optimization.