Fix long -> unsigned long long size mismatch in function return value.

Add #include <algorithm> to declare std::max for MS VS2013, at least.