MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / l_arithmetic

Function l_arithmetic

lua/ltypes.c:1350–1366  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1348}
1349
1350static int l_arithmetic(Lua lua, operation_t op)
1351{
1352 nullchk(lua, 1);
1353 nullchk(lua, 2);
1354 rank_t rank1 = getrank(lua, 1);
1355 rank_t rank2 = getrank(lua, 2);
1356 rank_t max = rank1 > rank2 ? rank1 : rank2;
1357 switch (max) {
1358 case RANK_INT: return l_int_arithmetic(lua, op);
1359 case RANK_REAL: return l_real_arithmetic(lua, op);
1360 case RANK_DECIMAL: return l_decimal_arithmetic(lua, op);
1361 case RANK_INTERVALDS: return l_intervalds_arithmetic(lua, op);
1362 case RANK_INTERVALYM: return l_intervalym_arithmetic(lua, op);
1363 case RANK_DATETIME: return l_datetime_arithmetic(lua, op);
1364 default: return luaL_error(lua, "bad arithmetic operation");
1365 }
1366}
1367
1368static int l_add(Lua lua)
1369{

Callers 5

l_addFunction · 0.85
l_subFunction · 0.85
l_mulFunction · 0.85
l_divFunction · 0.85
l_modFunction · 0.85

Calls 8

getrankFunction · 0.85
l_int_arithmeticFunction · 0.85
l_real_arithmeticFunction · 0.85
l_decimal_arithmeticFunction · 0.85
l_intervalds_arithmeticFunction · 0.85
l_intervalym_arithmeticFunction · 0.85
l_datetime_arithmeticFunction · 0.85
luaL_errorFunction · 0.85

Tested by

no test coverage detected