Three ways I know about:
(I rewrote the function as overload and became more readable for me.)
Actually declare a prototype:
float fmax(float4 float4);
float fmax(float4 float4) {
return fmax(
fmax(float4[0], float4[1]),
fmax(float4[2], float4[3])
);
}
Copy it to the statics file:
static float fmax(float4 float4) {
return fmax(
fmax(float4[0], float4[1]),
fmax(float4[2], float4[3])
);
}
:
namespace {
float fmax(float4 float4) {
return metal::fmax(
metal::fmax(float4[0], float4[1]),
metal::fmax(float4[2], float4[3])
);
}
}