MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / setfield

Function setfield

lib/lua/src/loslib.c:211–218  ·  view source on GitHub ↗

** About the overflow check: an overflow cannot occur when time ** is represented by a lua_Integer, because either lua_Integer is ** large enough to represent all int fields or it is not large enough ** to represent a time that cause a field to overflow. However, if ** times are represented as doubles and lua_Integer is int, then the ** time 0x1.e1853b0d184f6p+55 would cause an overflow when addi

Source from the content-addressed store, hash-verified

209** to compute the year.
210*/
211static void setfield (lua_State *L, const char *key, int value, int delta) {
212 #if (defined(LUA_NUMTIME) && LUA_MAXINTEGER <= INT_MAX)
213 if (l_unlikely(value > LUA_MAXINTEGER - delta))
214 luaL_error(L, "field '%s' is out-of-bound", key);
215 #endif
216 lua_pushinteger(L, (lua_Integer)value + delta);
217 lua_setfield(L, -2, key);
218}
219
220
221static void setboolfield (lua_State *L, const char *key, int value) {

Callers 1

setallfieldsFunction · 0.85

Calls 3

luaL_errorFunction · 0.85
lua_pushintegerFunction · 0.85
lua_setfieldFunction · 0.85

Tested by

no test coverage detected