Convert macro to inline function