lua

A copy of the Lua development repository
Log | Files | Refs | README

commit c7d4da8746bc03542501db3fc0c7fff7f8bc60ce
parent f1629217f136c37b58c912692b4d78f4314b4795
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date:   Mon,  8 Nov 2010 14:30:58 -0200

correction to allow lua_Unsigned larger than usigned int

Diffstat:
Mlbitlib.c | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lbitlib.c b/lbitlib.c @@ -1,5 +1,5 @@ /* -** $Id: lbitlib.c,v 1.9 2010/10/27 16:50:32 roberto Exp roberto $ +** $Id: lbitlib.c,v 1.10 2010/10/28 15:17:29 roberto Exp roberto $ ** Standard library for bitwise operations ** See Copyright Notice in lua.h */ @@ -108,7 +108,7 @@ static int b_rshift (lua_State *L) { static int b_arshift (lua_State *L) { b_uint r = getuintarg(L, 1); int i = luaL_checkint(L, 2); - if (i < 0 || !(r & (1 << (NBITS - 1)))) + if (i < 0 || !(r & ((b_uint)1 << (NBITS - 1)))) return b_shift(L, r, -i); else { /* arithmetic shift for 'negative' number */ if (i >= NBITS) r = ALLONES;