MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / LTnum

Function LTnum

extlibs/lua/src/lvm.c:479–495  ·  view source on GitHub ↗

** Return 'l < r', for numbers. */

Source from the content-addressed store, hash-verified

477** Return 'l < r', for numbers.
478*/
479static 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/*

Callers 1

luaV_lessthanFunction · 0.85

Calls 2

LTintfloatFunction · 0.85
LTfloatintFunction · 0.85

Tested by

no test coverage detected