From ad242a0c7a63c853f4f80ee7a722a304c4837565 Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Tue, 27 Nov 2012 08:36:04 -0600 Subject: [PATCH] No need to offset the shift value when the offset is 0 --- .../org/antlr/v4/tool/templates/codegen/Java/Java.stg | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tool/resources/org/antlr/v4/tool/templates/codegen/Java/Java.stg b/tool/resources/org/antlr/v4/tool/templates/codegen/Java/Java.stg index 6fe64b812..18838152a 100644 --- a/tool/resources/org/antlr/v4/tool/templates/codegen/Java/Java.stg +++ b/tool/resources/org/antlr/v4/tool/templates/codegen/Java/Java.stg @@ -463,7 +463,16 @@ testShiftInRange(shiftAmount) ::= << // produces smaller bytecode only when bits.ttypes contains more than two items bitsetBitfieldComparison(s, bits) ::= <% -( - })> && ((1L \<\< ( - )) & ( - ))}; separator=" | ">)) != 0) +(})> && ((1L \<\< ) & ()}; separator=" | ">)) != 0) +%> + +isZero ::= [ +"0":true, +default:false +] + +offsetShift(shiftAmount, offset) ::= <% +( - ) %> // produces more efficient bytecode when bits.ttypes contains at most two items