1 /* -*- Mode: C; c-basic-offset:4 ; -*- */
2 /*
3 * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
4 * University Research and Technology
5 * Corporation. All rights reserved.
6 * Copyright (c) 2004-2019 The University of Tennessee and The University
7 * of Tennessee Research Foundation. All rights
8 * reserved.
9 * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart,
10 * University of Stuttgart. All rights reserved.
11 * Copyright (c) 2004-2006 The Regents of the University of California.
12 * All rights reserved.
13 * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
14 * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
15 * $COPYRIGHT$
16 *
17 * Additional copyrights may follow
18 *
19 * $HEADER$
20 */
21
22 #include "ompi_config.h"
23 #include "ompi/datatype/ompi_datatype.h"
24 #include "ompi/datatype/ompi_datatype_internal.h"
25 #include "mpi.h"
26
27 int32_t ompi_datatype_create_contiguous( int count, const ompi_datatype_t* oldType,
28 ompi_datatype_t** newType )
29 {
30 ompi_datatype_t* pdt;
31
32 if( (0 == count) || (0 == oldType->super.size) ) {
33 return ompi_datatype_duplicate( &ompi_mpi_datatype_null.dt, newType);
34 }
35
36 pdt = ompi_datatype_create( oldType->super.desc.used + 2 );
37 opal_datatype_add( &(pdt->super), &(oldType->super), count, 0, (oldType->super.ub - oldType->super.lb) );
38 *newType = pdt;
39 return OMPI_SUCCESS;
40 }