Skip to content
Snippets Groups Projects
Commit 3302fc19 authored by dgelessus's avatar dgelessus
Browse files

Optimize binary search in lexer and parser slightly

This change was ported from SableCC 3.5.
parent d747149c
No related branches found
No related tags found
No related merge requests found
Pipeline #85046 passed
......@@ -179,7 +179,7 @@ public class Lexer implements ITokenListContainer
// an entry {Low, Up, Id} -> means if Low <= c <= Up -> goto state Id
while(low <= high)
{
int middle = (low + high) / 2;
int middle = (low + high) >>> 1;
int[] tmp2 = tmp1[middle];
if(c < tmp2[0])
......
......@@ -236,7 +236,7 @@ Macro:ParserCommon
while(low <= high)
{
int middle = (low + high) / 2;
int middle = (low + high) >>> 1;
if(state < gotoTable[index][middle][0])
{
......@@ -308,7 +308,7 @@ Macro:ParserCommon
while(low <= high)
{
int middle = (low + high) / 2;
int middle = (low + high) >>> 1;
if(index < Parser.actionTable[state()][middle][0])
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment