Use std::min and std::max rather than my ad-hoc #defines.