From e52350f421ef0d9c8dbe1736623ee0cc58a70eea Mon Sep 17 00:00:00 2001 From: Andre Murbach Maidl Date: Thu, 15 Oct 2015 23:21:49 -0300 Subject: Increasing MAXLABELS from 32 to 64 --- lptree.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'lptree.c') diff --git a/lptree.c b/lptree.c index f290d63..548128d 100644 --- a/lptree.c +++ b/lptree.c @@ -706,8 +706,8 @@ static int lp_throw (lua_State *L) { Labelset ls = 0; int i; for (i = 1; i <= n; i++) { - int d = (int)luaL_checkinteger(L, i); - luaL_argcheck(L, d >= 0 && d < (int)MAXLABELS, i, "invalid label index"); + long long int d = (long long int)luaL_checkinteger(L, i); + luaL_argcheck(L, d >= 0 && d < (long long int)MAXLABELS, i, "invalid label index"); setlabel(ls, d); } newlabelleaf(L, ls); @@ -723,8 +723,8 @@ static int lp_labchoice (lua_State *L) { int i; Labelset ls = 0; for (i = 3; i <= n; i++) { - int d = (int)luaL_checkinteger(L, i); - luaL_argcheck(L, d >= 0 && d < (int)MAXLABELS, i, "invalid label index"); + long long int d = (long long int)luaL_checkinteger(L, i); + luaL_argcheck(L, d >= 0 && d < (long long int)MAXLABELS, i, "invalid label index"); setlabel(ls, d); } tree = newroot2sib(L, TLabChoice); @@ -1205,11 +1205,11 @@ static int lp_match (lua_State *L) { r = match(L, s, s + i, s + l, code, capture, ptop, &labelf, &sfail); /* labeled failure */ /*printf("sfail = %s\n", sfail);*/ if (r == NULL) { /* labeled failure begin */ - int j = 0; + long long int j = 0; int n = 1; lua_pushnil(L); - while (j < (int) MAXLABELS) { - if (labelf & (1 << j)) { + while (j < (long long int) MAXLABELS) { + if (labelf & (1ULL << j)) { lua_pushinteger(L, j); n++; break; /* Changing the semantics: only one label */ -- cgit v1.2.3-55-g6feb