math: Replace naughty macro by an inline function