MCPcopy Create free account
hub / github.com/WaykiChain/WaykiChain / ExInt64AddFunc

Function ExInt64AddFunc

src/vm/luavm/lmylib.cpp:654–678  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

652}
653
654int32_t ExInt64AddFunc(lua_State *L) {
655 int32_t argc = lua_gettop(L); /* number of arguments */
656 if (argc != 2) {
657 return RetFalse("argc error\n");
658 }
659
660 if (!lua_isinteger(L, 1)) {
661 return RetFalse("Int64Add para1 error\n");
662 }
663 int64_t a = lua_tointeger(L, 1);
664
665 if (!lua_isinteger(L, 2)) {
666 return RetFalse("Int64Add para2 error\n");
667 }
668 int64_t b = lua_tointeger(L, 2);
669
670 int64_t c = 0;
671 LUA_BurnFuncCall(L, FUEL_CALL_Int64Add, BURN_VER_R2);
672 if (!SafeAdd(a, b, c)) {
673 return RetFalse("Int64Add Operate overflow !\n");
674 }
675
676 lua_pushinteger(L, c);
677 return 1;
678}
679
680int32_t ExInt64SubFunc(lua_State *L) {
681 int32_t argc = lua_gettop(L); /* number of arguments */

Callers

nothing calls this directly

Calls 5

lua_gettopFunction · 0.85
RetFalseFunction · 0.85
lua_isintegerFunction · 0.85
SafeAddFunction · 0.85
lua_pushintegerFunction · 0.85

Tested by

no test coverage detected