diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2018-02-21 09:54:26 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2018-02-21 09:54:26 -0300 |
commit | 465b47489910c8660f7d8f9869ffacdbb2d5d292 (patch) | |
tree | 3da1e80d05496bf48515dd71c55f14cdcb252ed1 /lvm.h | |
parent | 6353d619a594b5dfbef5dad10af9d4c051878466 (diff) | |
download | lua-465b47489910c8660f7d8f9869ffacdbb2d5d292.tar.gz lua-465b47489910c8660f7d8f9869ffacdbb2d5d292.tar.bz2 lua-465b47489910c8660f7d8f9869ffacdbb2d5d292.zip |
small reorganization of 'luaV_flttointeger'/'luaV_tointeger'
Diffstat (limited to 'lvm.h')
-rw-r--r-- | lvm.h | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lvm.h,v 2.48 2017/11/29 13:02:17 roberto Exp roberto $ | 2 | ** $Id: lvm.h,v 2.49 2018/02/19 20:06:56 roberto Exp roberto $ |
3 | ** Lua virtual machine | 3 | ** Lua virtual machine |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -50,13 +50,12 @@ | |||
50 | 50 | ||
51 | /* convert an object to an integer (including string coercion) */ | 51 | /* convert an object to an integer (including string coercion) */ |
52 | #define tointeger(o,i) \ | 52 | #define tointeger(o,i) \ |
53 | (ttisinteger(o) ? (*(i) = ivalue(o), 1) : luaV_tointeger(o,i,LUA_FLOORN2I)) | 53 | (ttisinteger(o) ? (*(i) = ivalue(o), 1) : luaV_tointeger(o,i,LUA_FLOORN2I)) |
54 | 54 | ||
55 | 55 | ||
56 | /* convert an object to an integer (without string coercion) */ | 56 | /* convert an object to an integer (without string coercion) */ |
57 | #define tointegerns(o,i) \ | 57 | #define tointegerns(o,i) \ |
58 | (ttisinteger(o) ? (*(i) = ivalue(o), 1) \ | 58 | (ttisinteger(o) ? (*(i) = ivalue(o), 1) : luaV_tointegerns(o,i,LUA_FLOORN2I)) |
59 | : luaV_flttointeger(o,i,LUA_FLOORN2I)) | ||
60 | 59 | ||
61 | 60 | ||
62 | #define intop(op,v1,v2) l_castU2S(l_castS2U(v1) op l_castS2U(v2)) | 61 | #define intop(op,v1,v2) l_castU2S(l_castS2U(v1) op l_castS2U(v2)) |
@@ -106,7 +105,8 @@ LUAI_FUNC int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r); | |||
106 | LUAI_FUNC int luaV_lessequal (lua_State *L, const TValue *l, const TValue *r); | 105 | LUAI_FUNC int luaV_lessequal (lua_State *L, const TValue *l, const TValue *r); |
107 | LUAI_FUNC int luaV_tonumber_ (const TValue *obj, lua_Number *n); | 106 | LUAI_FUNC int luaV_tonumber_ (const TValue *obj, lua_Number *n); |
108 | LUAI_FUNC int luaV_tointeger (const TValue *obj, lua_Integer *p, int mode); | 107 | LUAI_FUNC int luaV_tointeger (const TValue *obj, lua_Integer *p, int mode); |
109 | LUAI_FUNC int luaV_flttointeger (const TValue *obj, lua_Integer *p, int mode); | 108 | LUAI_FUNC int luaV_tointegerns (const TValue *obj, lua_Integer *p, int mode); |
109 | LUAI_FUNC int luaV_flttointeger (lua_Number n, lua_Integer *p, int mode); | ||
110 | LUAI_FUNC void luaV_finishget (lua_State *L, const TValue *t, TValue *key, | 110 | LUAI_FUNC void luaV_finishget (lua_State *L, const TValue *t, TValue *key, |
111 | StkId val, const TValue *slot); | 111 | StkId val, const TValue *slot); |
112 | LUAI_FUNC void luaV_finishset (lua_State *L, const TValue *t, TValue *key, | 112 | LUAI_FUNC void luaV_finishset (lua_State *L, const TValue *t, TValue *key, |