MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / mp_encode_lua_integer

Function mp_encode_lua_integer

deps/lua/src/lua_cmsgpack.c:355–362  ·  view source on GitHub ↗

Lua 5.3 has a built in 64-bit integer type */

Source from the content-addressed store, hash-verified

353
354/* Lua 5.3 has a built in 64-bit integer type */
355void mp_encode_lua_integer(lua_State *L, mp_buf *buf) {
356#if (LUA_VERSION_NUM < 503) && BITS_32
357 lua_Number i = lua_tonumber(L,-1);
358#else
359 lua_Integer i = lua_tointeger(L,-1);
360#endif
361 mp_encode_int(L, buf, (int64_t)i);
362}
363
364/* Lua 5.2 and lower only has 64-bit doubles, so we need to
365 * detect if the double may be representable as an int

Callers 2

mp_encode_lua_numberFunction · 0.85
mp_encode_lua_typeFunction · 0.85

Calls 3

lua_tonumberFunction · 0.85
lua_tointegerFunction · 0.85
mp_encode_intFunction · 0.85

Tested by

no test coverage detected