[PATCH v2 04/12 6.6.y] minmax: improve macro expansion and type checking