[PATCH v2 05/13 6.1.y] minmax: improve macro expansion and type checking