From d354e78afecfb2ba1875efc383ba5475623ce2cd Mon Sep 17 00:00:00 2001 From: Julian Seward Date: Sun, 12 Mar 2006 13:37:19 +0000 Subject: [PATCH] sizeofOneNamedTy(): handle long double correctly on non-x86/amd64 platforms. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5752 --- auxprogs/mpiwrap.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/auxprogs/mpiwrap.c b/auxprogs/mpiwrap.c index 4cb7cc7e7b..1a944de3fa 100644 --- a/auxprogs/mpiwrap.c +++ b/auxprogs/mpiwrap.c @@ -377,7 +377,10 @@ static void maybeFreeTy ( MPI_Datatype* ty ) exact size of one item of the type, NOT the size of it when padded suitably to make an array of them. In particular that's why the size of LONG_DOUBLE is 10 and not sizeof(long double), since the - latter is 12 at least on x86. Ref: MPI 1.1 doc p18 */ + latter is 12 at least on x86. Except if sizeof(long double) is + claimed to be 8 then we'd better respect that. + + Ref: MPI 1.1 doc p18 */ static long sizeofOneNamedTy ( MPI_Datatype ty ) { if (ty == MPI_CHAR) return sizeof(signed char); @@ -390,8 +393,10 @@ static long sizeofOneNamedTy ( MPI_Datatype ty ) if (ty == MPI_UNSIGNED_LONG) return sizeof(unsigned long int); if (ty == MPI_FLOAT) return sizeof(float); if (ty == MPI_DOUBLE) return sizeof(double); - if (ty == MPI_LONG_DOUBLE) return 10; /* NOT: sizeof(long double); */ if (ty == MPI_BYTE) return 1; + if (ty == MPI_LONG_DOUBLE) + return sizeof(long double)==8 + ? 8 : 10; /* NOT: sizeof(long double); */ /* MPI_PACKED */ /* new in MPI2: */ # if defined(MPI_WCHAR) -- 2.47.2