Metal Inline Functions

Hi! How to define and call an inline function in Metal? Or simple function that will return some value.

Case:

inline uint index4D(constant _4D& shape,
                    constant uint& n,
                    constant uint& c,
                    constant uint& h,
                    constant uint& w) {
    return n * shape.C * shape.H * shape.W + c * shape.H * shape.W + h * shape.W + w;
}

When I call it in my kernel function I get No matching function for call error.

Thx in advance.

Can you post how you're using this is in a kernel function as well how you're building the library?

Metal Inline Functions
 
 
Q