[PATCH v3 03/11 6.1.y] minmax: improve macro expansion and type checking