From c7d4da8746bc03542501db3fc0c7fff7f8bc60ce Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Mon, 8 Nov 2010 14:31:22 -0200 Subject: [PATCH] correction to allow lua_Unsigned larger than usigned int --- lbitlib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lbitlib.c b/lbitlib.c index 0656ce28..b6b2442c 100644 --- 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;