On Thursday, 1 April 2021 at 18:38:45 UTC, Steven Schveighoffer wrote:
>Here is a relevant run.dlang.io snippet: https://run.dlang.io/is/UEtyE8
Some interesting things about this:
- With -w, I get no errors.
- With -wi, I get a warning that the function can be inlined
- Using ASM view, it appears the function is NOT inlined in either case.
DMD's inliner often gets confused by multiple return
statements. The solution is to either convert to single-return
style, or use LDC/GDC which do not have this problem.
extern(C) pragma(inline, true) static float EaseBounceOut(float t, float b, float c, float d)
{
float ret;
if ((t/=d) < (1.0f/2.75f))
{
ret = (c*(7.5625f*t*t) + b);
}
else if (t < (2.0f/2.75f))
{
float postFix = t-=(1.5f/2.75f);
ret = (c*(7.5625f*(postFix)*t + 0.75f) + b);
}
else if (t < (2.5/2.75))
{
float postFix = t-=(2.25f/2.75f);
ret = (c*(7.5625f*(postFix)*t + 0.9375f) + b);
}
else
{
float postFix = t-=(2.625f/2.75f);
ret = (c*(7.5625f*(postFix)*t + 0.984375f) + b);
}
return ret;
}
(I have no comment on the larger issues that you raised. Also, hurray for rich text formatting!)