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

Function ExInt64SubFunc

src/vm/luavm/lmylib.cpp:680–704  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

678}
679
680int32_t ExInt64SubFunc(lua_State *L) {
681 int32_t argc = lua_gettop(L); /* number of arguments */
682 if (argc != 2) {
683 return RetFalse("argc error\n");
684 }
685
686 if (!lua_isinteger(L, 1)) {
687 return RetFalse("Int64Sub para1 error\n");
688 }
689 int64_t a = lua_tointeger(L, 1);
690
691 if (!lua_isinteger(L, 2)) {
692 return RetFalse("Int64Sub para2 error\n");
693 }
694 int64_t b = lua_tointeger(L, 2);
695
696 int64_t c = 0;
697 LUA_BurnFuncCall(L, FUEL_CALL_Int64Sub, BURN_VER_R2);
698 if (!SafeSubtract(a, b, c)) {
699 return RetFalse("Int64Sub Operate overflow !\n");
700 }
701
702 lua_pushinteger(L, c);
703 return 1;
704}
705
706int32_t ExInt64DivFunc(lua_State *L) {
707 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
SafeSubtractFunction · 0.85
lua_pushintegerFunction · 0.85

Tested by

no test coverage detected