forked from jasder/antlr
No need to offset the shift value when the offset is 0
This commit is contained in:
parent
7c5ec45054
commit
ad242a0c7a
|
@ -463,7 +463,16 @@ testShiftInRange(shiftAmount) ::= <<
|
|||
|
||||
// produces smaller bytecode only when bits.ttypes contains more than two items
|
||||
bitsetBitfieldComparison(s, bits) ::= <%
|
||||
(<testShiftInRange({<s.varName> - <bits.shift>})> && ((1L \<\< (<s.varName> - <bits.shift>)) & (<bits.ttypes:{ttype | (1L \<\< (<ttype> - <bits.shift>))}; separator=" | ">)) != 0)
|
||||
(<testShiftInRange({<offsetShift(s.varName, bits.shift)>})> && ((1L \<\< <offsetShift(s.varName, bits.shift)>) & (<bits.ttypes:{ttype | (1L \<\< <offsetShift(ttype, bits.shift)>)}; separator=" | ">)) != 0)
|
||||
%>
|
||||
|
||||
isZero ::= [
|
||||
"0":true,
|
||||
default:false
|
||||
]
|
||||
|
||||
offsetShift(shiftAmount, offset) ::= <%
|
||||
<if(!isZero.(offset))>(<shiftAmount> - <offset>)<else><shiftAmount><endif>
|
||||
%>
|
||||
|
||||
// produces more efficient bytecode when bits.ttypes contains at most two items
|
||||
|
|
Loading…
Reference in New Issue