From 5b860c6afb0201a9ce655862b5df9aa9da97ca13 Mon Sep 17 00:00:00 2001
From: Ben Boeckel <ben.boeckel@kitware.com>
Date: Sun, 2 Feb 2025 21:18:13 +0100
Subject: [PATCH] vtkMPICommunicator: use `std::min` rather than a custom impl

---
 Parallel/MPI/vtkMPICommunicator.cxx | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/Parallel/MPI/vtkMPICommunicator.cxx b/Parallel/MPI/vtkMPICommunicator.cxx
index 5e6f318509a..202d8a15c2a 100644
--- a/Parallel/MPI/vtkMPICommunicator.cxx
+++ b/Parallel/MPI/vtkMPICommunicator.cxx
@@ -13,6 +13,7 @@
 #include "vtkStructuredGrid.h"
 #define VTK_CREATE(type, name) vtkSmartPointer<type> name = vtkSmartPointer<type>::New()
 
+#include <algorithm>
 #include <cassert>
 #include <type_traits> // for std::is_pointer
 #include <vector>
@@ -991,12 +992,6 @@ int vtkMPICommunicator::SendVoidArray(
     tag, mpiType, this->MPIComm->Handle, vtkCommunicator::UseCopy, this->UseSsend));
 }
 
-//------------------------------------------------------------------------------
-inline vtkIdType vtkMPICommunicatorMin(vtkIdType a, vtkIdType b)
-{
-  return (a > b) ? b : a;
-}
-
 //------------------------------------------------------------------------------
 int vtkMPICommunicator::ReceiveVoidArray(
   void* data, vtkIdType maxlength, int type, int remoteProcessId, int tag)
@@ -1042,9 +1037,9 @@ int vtkMPICommunicator::ReceiveVoidArray(
   vtkMPICommunicatorReceiveDataInfo info;
   info.Handle = this->MPIComm->Handle;
   info.DataType = mpiType;
-  while (CheckForMPIError(this->ReceiveDataInternal(byteData,
-           vtkMPICommunicatorMin(maxlength, maxReceive), sizeOfType, remoteProcessId, tag, &info,
-           vtkCommunicator::UseCopy, this->LastSenderId)) != 0)
+  while (
+    CheckForMPIError(this->ReceiveDataInternal(byteData, std::min<vtkIdType>(maxlength, maxReceive),
+      sizeOfType, remoteProcessId, tag, &info, vtkCommunicator::UseCopy, this->LastSenderId)) != 0)
   {
     remoteProcessId = this->LastSenderId;
 
-- 
GitLab