** Return 'l <= r', for numbers. */
| 510 | ** Return 'l <= r', for numbers. |
| 511 | */ |
| 512 | l_sinline int LEnum (const TValue *l, const TValue *r) { |
| 513 | lua_assert(ttisnumber(l) && ttisnumber(r)); |
| 514 | if (ttisinteger(l)) { |
| 515 | lua_Integer li = ivalue(l); |
| 516 | if (ttisinteger(r)) |
| 517 | return li <= ivalue(r); /* both are integers */ |
| 518 | else /* 'l' is int and 'r' is float */ |
| 519 | return LEintfloat(li, fltvalue(r)); /* l <= r ? */ |
| 520 | } |
| 521 | else { |
| 522 | lua_Number lf = fltvalue(l); /* 'l' must be float */ |
| 523 | if (ttisfloat(r)) |
| 524 | return luai_numle(lf, fltvalue(r)); /* both are float */ |
| 525 | else /* 'l' is float and 'r' is int */ |
| 526 | return LEfloatint(lf, ivalue(r)); |
| 527 | } |
| 528 | } |
| 529 | |
| 530 | |
| 531 | /* |
no test coverage detected