MCPcopy Create free account
hub / github.com/DFHack/dfhack / LEnum

Function LEnum

depends/lua/src/lvm.c:341–358  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

339** Return 'l <= r', for numbers.
340*/
341static int LEnum (const TValue *l, const TValue *r) {
342 if (ttisinteger(l)) {
343 lua_Integer li = ivalue(l);
344 if (ttisinteger(r))
345 return li <= ivalue(r); /* both are integers */
346 else /* 'l' is int and 'r' is float */
347 return LEintfloat(li, fltvalue(r)); /* l <= r ? */
348 }
349 else {
350 lua_Number lf = fltvalue(l); /* 'l' must be float */
351 if (ttisfloat(r))
352 return luai_numle(lf, fltvalue(r)); /* both are float */
353 else if (luai_numisnan(lf)) /* 'r' is int and 'l' is float */
354 return 0; /* NaN <= i is always false */
355 else /* without NaN, (l <= r) <--> not(r < l) */
356 return !LTintfloat(ivalue(r), lf); /* not (r < l) ? */
357 }
358}
359
360
361/*

Callers 1

luaV_lessequalFunction · 0.85

Calls 2

LEintfloatFunction · 0.85
LTintfloatFunction · 0.85

Tested by

no test coverage detected