[Issue 15110] New: pragma(inline) rarely works how I want it to
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Thu Sep 24 08:01:20 PDT 2015
https://issues.dlang.org/show_bug.cgi?id=15110
Issue ID: 15110
Summary: pragma(inline) rarely works how I want it to
Product: D
Version: D2
Hardware: x86_64
OS: Windows
Status: NEW
Severity: enhancement
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: turkeyman at gmail.com
pragma(inline, true)
R normalisedSubtract(T, U, R = ResultType!(T, U))(T a, U b)
{
R x = cast(R)a;//convertNormInt!R(a);
R y = cast(R)b;//convertNormInt!R(b);
static if(isUnsigned!R)
{
if(x <= y)
return 0;
return cast(R)(x - y);
}
else
{
auto r = x - y;
if(r < R.min)
r = R.min;
else static if(isSigned!R)
{
if(r > R.max)
r = R.max;
}
return cast(R)r;
}
}
src\std\experimental\color\internal\normint.d(90): Error: function
std.experimental.color.internal.normint.normalisedSubtract!(ubyte, ubyte,
ubyte).normalisedSubtract cannot inline function
This function is literally nothing more than a single integer subtract.
I have no idea why this won't inline. I experience this general problem quite a
bit.
Strangely, the addition compliment to this function doesn't complain.
--
More information about the Digitalmars-d-bugs
mailing list