Explicitly cast std::min's arguments to avoid type mismatches.