MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / LTnum

Function LTnum

3rd/lua-5.4.3/src/lvm.c:476–492  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

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

Callers 1

luaV_lessthanFunction · 0.85

Calls 2

LTintfloatFunction · 0.85
LTfloatintFunction · 0.85

Tested by

no test coverage detected