diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2021-09-15 11:18:41 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2021-09-15 11:18:41 -0300 |
| commit | 2ff34717227b8046b0fdcb96206f11f5e888664e (patch) | |
| tree | 112f054406eaa82363716882b4300d4ff98ab2ef /lvm.c | |
| parent | 9db4bfed6bb9d5828c99c0f24749eedf54d70cc2 (diff) | |
| download | lua-2ff34717227b8046b0fdcb96206f11f5e888664e.tar.gz lua-2ff34717227b8046b0fdcb96206f11f5e888664e.tar.bz2 lua-2ff34717227b8046b0fdcb96206f11f5e888664e.zip | |
Using 'inline' in some functions
According to ISO C, "making a function an inline function suggests that
calls to the function be as fast as possible." (Not available in C89.)
Diffstat (limited to 'lvm.c')
| -rw-r--r-- | lvm.c | 12 |
1 files changed, 6 insertions, 6 deletions
| @@ -406,7 +406,7 @@ static int l_strcmp (const TString *ls, const TString *rs) { | |||
| 406 | ** from float to int.) | 406 | ** from float to int.) |
| 407 | ** When 'f' is NaN, comparisons must result in false. | 407 | ** When 'f' is NaN, comparisons must result in false. |
| 408 | */ | 408 | */ |
| 409 | static int LTintfloat (lua_Integer i, lua_Number f) { | 409 | l_sinline int LTintfloat (lua_Integer i, lua_Number f) { |
| 410 | if (l_intfitsf(i)) | 410 | if (l_intfitsf(i)) |
| 411 | return luai_numlt(cast_num(i), f); /* compare them as floats */ | 411 | return luai_numlt(cast_num(i), f); /* compare them as floats */ |
| 412 | else { /* i < f <=> i < ceil(f) */ | 412 | else { /* i < f <=> i < ceil(f) */ |
| @@ -423,7 +423,7 @@ static int LTintfloat (lua_Integer i, lua_Number f) { | |||
| 423 | ** Check whether integer 'i' is less than or equal to float 'f'. | 423 | ** Check whether integer 'i' is less than or equal to float 'f'. |
| 424 | ** See comments on previous function. | 424 | ** See comments on previous function. |
| 425 | */ | 425 | */ |
| 426 | static int LEintfloat (lua_Integer i, lua_Number f) { | 426 | l_sinline int LEintfloat (lua_Integer i, lua_Number f) { |
| 427 | if (l_intfitsf(i)) | 427 | if (l_intfitsf(i)) |
| 428 | return luai_numle(cast_num(i), f); /* compare them as floats */ | 428 | return luai_numle(cast_num(i), f); /* compare them as floats */ |
| 429 | else { /* i <= f <=> i <= floor(f) */ | 429 | else { /* i <= f <=> i <= floor(f) */ |
| @@ -440,7 +440,7 @@ static int LEintfloat (lua_Integer i, lua_Number f) { | |||
| 440 | ** Check whether float 'f' is less than integer 'i'. | 440 | ** Check whether float 'f' is less than integer 'i'. |
| 441 | ** See comments on previous function. | 441 | ** See comments on previous function. |
| 442 | */ | 442 | */ |
| 443 | static int LTfloatint (lua_Number f, lua_Integer i) { | 443 | l_sinline int LTfloatint (lua_Number f, lua_Integer i) { |
| 444 | if (l_intfitsf(i)) | 444 | if (l_intfitsf(i)) |
| 445 | return luai_numlt(f, cast_num(i)); /* compare them as floats */ | 445 | return luai_numlt(f, cast_num(i)); /* compare them as floats */ |
| 446 | else { /* f < i <=> floor(f) < i */ | 446 | else { /* f < i <=> floor(f) < i */ |
| @@ -457,7 +457,7 @@ static int LTfloatint (lua_Number f, lua_Integer i) { | |||
| 457 | ** Check whether float 'f' is less than or equal to integer 'i'. | 457 | ** Check whether float 'f' is less than or equal to integer 'i'. |
| 458 | ** See comments on previous function. | 458 | ** See comments on previous function. |
| 459 | */ | 459 | */ |
| 460 | static int LEfloatint (lua_Number f, lua_Integer i) { | 460 | l_sinline int LEfloatint (lua_Number f, lua_Integer i) { |
| 461 | if (l_intfitsf(i)) | 461 | if (l_intfitsf(i)) |
| 462 | return luai_numle(f, cast_num(i)); /* compare them as floats */ | 462 | return luai_numle(f, cast_num(i)); /* compare them as floats */ |
| 463 | else { /* f <= i <=> ceil(f) <= i */ | 463 | else { /* f <= i <=> ceil(f) <= i */ |
| @@ -473,7 +473,7 @@ static int LEfloatint (lua_Number f, lua_Integer i) { | |||
| 473 | /* | 473 | /* |
| 474 | ** Return 'l < r', for numbers. | 474 | ** Return 'l < r', for numbers. |
| 475 | */ | 475 | */ |
| 476 | static int LTnum (const TValue *l, const TValue *r) { | 476 | l_sinline int LTnum (const TValue *l, const TValue *r) { |
| 477 | lua_assert(ttisnumber(l) && ttisnumber(r)); | 477 | lua_assert(ttisnumber(l) && ttisnumber(r)); |
| 478 | if (ttisinteger(l)) { | 478 | if (ttisinteger(l)) { |
| 479 | lua_Integer li = ivalue(l); | 479 | lua_Integer li = ivalue(l); |
| @@ -495,7 +495,7 @@ static int LTnum (const TValue *l, const TValue *r) { | |||
| 495 | /* | 495 | /* |
| 496 | ** Return 'l <= r', for numbers. | 496 | ** Return 'l <= r', for numbers. |
| 497 | */ | 497 | */ |
| 498 | static int LEnum (const TValue *l, const TValue *r) { | 498 | l_sinline int LEnum (const TValue *l, const TValue *r) { |
| 499 | lua_assert(ttisnumber(l) && ttisnumber(r)); | 499 | lua_assert(ttisnumber(l) && ttisnumber(r)); |
| 500 | if (ttisinteger(l)) { | 500 | if (ttisinteger(l)) { |
| 501 | lua_Integer li = ivalue(l); | 501 | lua_Integer li = ivalue(l); |
