root/mpich2/trunk/src/mpid/common/datatype/mpid_ext32_datatype.c @ 4865

Revision 4865, 2.0 KB (checked in by buntinas, 5 months ago)

stomped some warnings

Line 
1/* -*- Mode: C; c-basic-offset:4 ; -*- */
2
3/*
4 *  (C) 2001 by Argonne National Laboratory.
5 *      See COPYRIGHT in top-level directory.
6 */
7
8#include <stdio.h>
9#include <stdlib.h>
10
11#include <mpichconf.h>
12#include <mpiimpl.h>
13#include <mpid_dataloop.h>
14
15
16typedef struct external32_basic_size
17{
18    MPI_Datatype el_type;
19    MPI_Aint el_size;
20} external32_basic_size_t;
21
22static external32_basic_size_t external32_basic_size_array[] =
23{
24    { MPI_PACKED, 1 },
25    { MPI_BYTE, 1 },
26    { MPI_CHAR, 1 },
27    { MPI_UNSIGNED_CHAR, 1 },
28    { MPI_SHORT, 2 },
29    { MPI_UNSIGNED_SHORT, 2 },
30    { MPI_INT, 4 },
31    { MPI_UNSIGNED, 4 },
32    { MPI_LONG, 4 },
33    { MPI_UNSIGNED_LONG, 4 },
34    { MPI_FLOAT, 4 },
35    { MPI_DOUBLE, 8 },
36    { MPI_LONG_DOUBLE, 16 },
37    { MPI_CHARACTER, 1 },
38    { MPI_LOGICAL, 4 },
39    { MPI_INTEGER, 4 },
40    { MPI_REAL, 4 }, 
41    { MPI_DOUBLE_PRECISION, 8 },
42    { MPI_COMPLEX, 8 },
43    { MPI_DOUBLE_COMPLEX, 16 },
44#ifdef HAVE_FORTRAN_BINDING
45    { MPI_SIGNED_CHAR, 1 },
46    { MPI_WCHAR, 2 },
47    { MPI_INTEGER1, 1 },
48    { MPI_INTEGER2, 2 },
49    { MPI_INTEGER4, 4 },
50    { MPI_INTEGER8, 8 },
51    { MPI_UNSIGNED_LONG_LONG, 8 },
52    { MPI_REAL4, 4 },
53    { MPI_REAL8, 8 },
54    { MPI_REAL16, 16 },
55#endif
56    { MPI_LONG_LONG, 8 }
57};
58
59MPI_Aint MPIDI_Datatype_get_basic_size_external32(MPI_Datatype el_type)
60{
61    MPI_Aint ret = (MPI_Aint) 0;
62    unsigned int i = 0;
63    for(i = 0; i < (sizeof(external32_basic_size_array) /
64                    sizeof(external32_basic_size_t)); i++)
65    {
66        if (external32_basic_size_array[i].el_type == el_type)
67        {
68            ret = external32_basic_size_array[i].el_size;
69            break;
70        }
71    }
72    return ret;
73}
74
75MPI_Aint MPID_Datatype_size_external32(MPI_Datatype type)
76{
77    if (HANDLE_GET_KIND(type) == HANDLE_KIND_BUILTIN) {
78        return MPIDI_Datatype_get_basic_size_external32(type);
79    }
80    else {
81        MPID_Dataloop *dlp = NULL;
82
83        MPID_Datatype_get_loopptr_macro(type, dlp, MPID_DATALOOP_HETEROGENEOUS);
84
85        return MPID_Dataloop_stream_size(dlp,
86                                         MPIDI_Datatype_get_basic_size_external32);
87    }
88}
Note: See TracBrowser for help on using the browser.