Fix Visual Studio 2013 build.

It's really picky about std::min and std::max it seems. :P