For master I went through all MAX() and MIN() uses for candidates to change. For older branches I just ported those same changes, not checking if there would be additional candidates in them - except for porting gtk3.22-client changes to older gtk-clients supported only in older branches.
We have some MAX() and MIN() uses where one of the parameters is relatively heavy to evaluate AND such that the compiler cannot optimize away the need to do the full evaluation twice (a function call of which compiler does not know that it will return the same value both times, and has no side-effects)
Move such heavy evaluations outside the macros, to do them only once.