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-2010 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 "opal_config.h"
23 #include "opal/constants.h"
24 #include "opal/datatype/opal_datatype.h"
25 #include "opal/datatype/opal_datatype_internal.h"
26
27 int32_t opal_datatype_create_contiguous( int count, const opal_datatype_t* oldType,
28 opal_datatype_t** newType )
29 {
30 opal_datatype_t* pdt;
31
32 if( 0 == count ) {
33 pdt = opal_datatype_create( 0 );
34 opal_datatype_add( pdt, &opal_datatype_empty, 0, 0, 0 );
35 } else {
36 pdt = opal_datatype_create( oldType->desc.used + 2 );
37 opal_datatype_add( pdt, oldType, count, 0, (oldType->ub - oldType->lb) );
38 }
39 *newType = pdt;
40 return OPAL_SUCCESS;
41 }