new macros 'chgfltvalue'/'chgivalue' (numerical for loop does

not need to set the type of its internal variable at each iteration)
This commit is contained in:
Roberto Ierusalimschy
2015-03-02 13:04:52 -03:00
parent 91efb4b895
commit 6408bc0b7f
2 changed files with 10 additions and 4 deletions

View File

@@ -1,5 +1,5 @@
/*
** $Id: lobject.h,v 2.106 2015/01/05 13:52:37 roberto Exp roberto $
** $Id: lobject.h,v 2.107 2015/01/16 16:54:37 roberto Exp roberto $
** Type definitions for Lua objects
** See Copyright Notice in lua.h
*/
@@ -190,9 +190,15 @@ typedef struct lua_TValue TValue;
#define setfltvalue(obj,x) \
{ TValue *io=(obj); val_(io).n=(x); settt_(io, LUA_TNUMFLT); }
#define chgfltvalue(obj,x) \
{ TValue *io=(obj); lua_assert(ttisfloat(io)); val_(io).n=(x); }
#define setivalue(obj,x) \
{ TValue *io=(obj); val_(io).i=(x); settt_(io, LUA_TNUMINT); }
#define chgivalue(obj,x) \
{ TValue *io=(obj); lua_assert(ttisinteger(io)); val_(io).i=(x); }
#define setnilvalue(obj) settt_(obj, LUA_TNIL)
#define setfvalue(obj,x) \