From 8f961da3dbf8c45389d1431e6dff8e44e41f1a57 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Tue, 15 Apr 2014 11:29:30 -0300 Subject: macros cast_integer/cast_unsigned replaced by cast_u2s/cast_s2u, that should be used only between lua_Integer and lua_Unsigned --- llimits.h | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'llimits.h') diff --git a/llimits.h b/llimits.h index 1286ddba..0feba1d9 100644 --- a/llimits.h +++ b/llimits.h @@ -1,5 +1,5 @@ /* -** $Id: llimits.h,v 1.113 2014/04/11 19:56:04 roberto Exp roberto $ +** $Id: llimits.h,v 1.114 2014/04/12 14:45:10 roberto Exp roberto $ ** Limits, basic types, and some other `installation-dependent' definitions ** See Copyright Notice in lua.h */ @@ -105,8 +105,17 @@ typedef LUAI_UACINT l_uacInt; #define cast_num(i) cast(lua_Number, (i)) #define cast_int(i) cast(int, (i)) #define cast_uchar(i) cast(unsigned char, (i)) -#define cast_integer(i) cast(lua_Integer, (i)) -#define cast_unsigned(i) cast(lua_Unsigned, (i)) + + +/* +** cast a lua_Unsigned to a signed lua_Integer; this cast is +** not strict ANSI C, but two-complement architectures should +** work fine. +*/ +#define cast_u2s(i) ((lua_Integer)(i)) + +/* cast a signed lua_Integer to lua_Unsigned */ +#define cast_s2u(i) ((lua_Unsigned)(i)) /* -- cgit v1.2.3-55-g6feb