** Return 'l <= r', for numbers. */
| 496 | ** Return 'l <= r', for numbers. |
| 497 | */ |
| 498 | static int LEnum (const TValue *l, const TValue *r) { |
| 499 | lua_assert(ttisnumber(l) && ttisnumber(r)); |
| 500 | if (ttisinteger(l)) { |
| 501 | lua_Integer li = ivalue(l); |
| 502 | if (ttisinteger(r)) |
| 503 | return li <= ivalue(r); /* both are integers */ |
| 504 | else /* 'l' is int and 'r' is float */ |
| 505 | return LEintfloat(li, fltvalue(r)); /* l <= r ? */ |
| 506 | } |
| 507 | else { |
| 508 | lua_Number lf = fltvalue(l); /* 'l' must be float */ |
| 509 | if (ttisfloat(r)) |
| 510 | return luai_numle(lf, fltvalue(r)); /* both are float */ |
| 511 | else /* 'l' is float and 'r' is int */ |
| 512 | return LEfloatint(lf, ivalue(r)); |
| 513 | } |
| 514 | } |
| 515 | |
| 516 | |
| 517 | /* |
no test coverage detected