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

Function ExInt64DivFunc

src/vm/luavm/lmylib.cpp:706–730  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

704}
705
706int32_t ExInt64DivFunc(lua_State *L) {
707 int32_t argc = lua_gettop(L); /* number of arguments */
708 if (argc != 2) {
709 return RetFalse("argc error\n");
710 }
711
712 if (!lua_isinteger(L, 1)) {
713 return RetFalse("Int64Div para1 error\n");
714 }
715 int64_t a = lua_tointeger(L, 1);
716
717 if (!lua_isinteger(L, 2)) {
718 return RetFalse("Int64Div para2 error\n");
719 }
720 int64_t b = lua_tointeger(L, 2);
721
722 int64_t c = 0;
723 LUA_BurnFuncCall(L, FUEL_CALL_Int64Div, BURN_VER_R2);
724 if (!SafeDivide(a, b, c)) {
725 return RetFalse("Int64Div Operate overflow !\n");
726 }
727
728 lua_pushinteger(L, c);
729 return 1;
730}
731
732/**
733 *bool SHA256(void const* pfrist, const uint16_t len, void * const pout)

Callers

nothing calls this directly

Calls 5

lua_gettopFunction · 0.85
RetFalseFunction · 0.85
lua_isintegerFunction · 0.85
SafeDivideFunction · 0.85
lua_pushintegerFunction · 0.85

Tested by

no test coverage detected