Non-macro implementation of min and max