| 1348 | } |
| 1349 | |
| 1350 | static 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 | |
| 1368 | static int l_add(Lua lua) |
| 1369 | { |
no test coverage detected