From 497c042dd4e2ec519259590ee08819612912030d Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Mon, 14 Apr 2008 13:51:18 +0000 Subject: [PATCH] Define is_mpi_datatype appropriately for wchar_t and long long/int64 types [SVN r44412] --- include/boost/mpi/datatype.hpp | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/include/boost/mpi/datatype.hpp b/include/boost/mpi/datatype.hpp index 70600df..9a4664e 100644 --- a/include/boost/mpi/datatype.hpp +++ b/include/boost/mpi/datatype.hpp @@ -263,25 +263,38 @@ struct is_mpi_datatype > { }; - -#if 0 -#ifndef BOOST_NO_INTRINSIC_WCHAR_T +// Define wchar_t specialization of is_mpi_datatype, if possible. +#if !defined(BOOST_NO_INTRINSIC_WCHAR_T) && \ + (defined(MPI_WCHAR) || (defined(MPI_VERSION) && MPI_VERSION >= 2)) BOOST_MPI_DATATYPE(wchar_t, MPI_WCHAR, builtin); #endif -#ifdef BOOST_HAS_LONG_LONG +// Define long long or __int64 specialization of is_mpi_datatype, if possible. +#if defined(BOOST_HAS_LONG_LONG) && \ + (defined(MPI_LONG_LONG_INT) || (defined(MPI_VERSION) && MPI_VERSION >= 2)) BOOST_MPI_DATATYPE(long long, MPI_LONG_LONG_INT, builtin); -BOOST_MPI_DATATYPE(unsigned long long, MPI_UNSIGNED_LONG_LONG, builtin); +#elif defined(BOOST_HAS_MS_INT64) && \ + (defined(MPI_LONG_LONG_INT) || (defined(MPI_VERSION) && MPI_VERSION >= 2)) +BOOST_MPI_DATATYPE(__int64, MPI_LONG_LONG_INT, builtin); #endif + +// Define unsigned long long or unsigned __int64 specialization of +// is_mpi_datatype, if possible. We separate this from the check for +// the (signed) long long/__int64 because some MPI implementations +// (e.g., MPICH-MX) have MPI_LONG_LONG_INT but not +// MPI_UNSIGNED_LONG_LONG. +#if defined(BOOST_HAS_LONG_LONG) && \ + (defined(MPI_UNSIGNED_LONG_LONG) \ + || (defined(MPI_VERSION) && MPI_VERSION >= 2)) +BOOST_MPI_DATATYPE(unsigned long long, MPI_UNSIGNED_LONG_LONG, builtin); +#elif defined(BOOST_HAS_MS_INT64) && \ + (defined(MPI_UNSIGNED_LONG_LONG) \ + || (defined(MPI_VERSION) && MPI_VERSION >= 2)) +BOOST_MPI_DATATYPE(unsigned __int64, MPI_UNSIGNED_LONG_LONG, builtin); #endif #endif // Doxygen -#if defined(BOOST_MSVC) || defined(BOOST_INTEL_WIN) -BOOST_MPI_DATATYPE(__int64, MPI_LONG_LONG_INT, builtin); -BOOST_MPI_DATATYPE(unsigned __int64, MPI_UNSIGNED_LONG_LONG, builtin); -#endif - namespace detail { inline MPI_Datatype build_mpi_datatype_for_bool() {