** Return 'l < r', for numbers. */
| 477 | ** Return 'l < r', for numbers. |
| 478 | */ |
| 479 | static int LTnum (const TValue *l, const TValue *r) { |
| 480 | lua_assert(ttisnumber(l) && ttisnumber(r)); |
| 481 | if (ttisinteger(l)) { |
| 482 | lua_Integer li = ivalue(l); |
| 483 | if (ttisinteger(r)) |
| 484 | return li < ivalue(r); /* both are integers */ |
| 485 | else /* 'l' is int and 'r' is float */ |
| 486 | return LTintfloat(li, fltvalue(r)); /* l < r ? */ |
| 487 | } |
| 488 | else { |
| 489 | lua_Number lf = fltvalue(l); /* 'l' must be float */ |
| 490 | if (ttisfloat(r)) |
| 491 | return luai_numlt(lf, fltvalue(r)); /* both are float */ |
| 492 | else /* 'l' is float and 'r' is int */ |
| 493 | return LTfloatint(lf, ivalue(r)); |
| 494 | } |
| 495 | } |
| 496 | |
| 497 | |
| 498 | /* |
no test coverage detected