summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--perly.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/perly.c b/perly.c
index d20e4e3b7d..ac6112af2f 100644
--- a/perly.c
+++ b/perly.c
@@ -355,9 +355,11 @@ Perl_yyparse (pTHX_ int gramtype)
}
/* If the proper action on seeing token YYTOKEN is to reduce or to
- detect an error, take that action. */
+ * detect an error, take that action.
+ * Casting yyn to unsigned allows a >=0 test to be included as
+ * part of the <=YYLAST test for speed */
yyn += yytoken;
- if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
+ if ((unsigned int)yyn > YYLAST || yycheck[yyn] != yytoken)
goto yydefault;
yyn = yytable[yyn];
if (yyn <= 0) {