Blame src/mpi/misc/aint_add.c

Packit Service c5cf8c
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
Packit Service c5cf8c
/*
Packit Service c5cf8c
 *
Packit Service c5cf8c
 *  (C) 2014 by Argonne National Laboratory.
Packit Service c5cf8c
 *      See COPYRIGHT in top-level directory.
Packit Service c5cf8c
 */
Packit Service c5cf8c
Packit Service c5cf8c
#include "mpiimpl.h"
Packit Service c5cf8c
Packit Service c5cf8c
/* -- Begin Profiling Symbol Block for routine MPI_Aint_add */
Packit Service c5cf8c
#if defined(HAVE_PRAGMA_WEAK)
Packit Service c5cf8c
#pragma weak MPI_Aint_add = PMPI_Aint_add
Packit Service c5cf8c
#elif defined(HAVE_PRAGMA_HP_SEC_DEF)
Packit Service c5cf8c
#pragma _HP_SECONDARY_DEF PMPI_Aint_add  MPI_Aint_add
Packit Service c5cf8c
#elif defined(HAVE_PRAGMA_CRI_DUP)
Packit Service c5cf8c
#pragma _CRI duplicate MPI_Aint_add as PMPI_Aint_add
Packit Service c5cf8c
#elif defined(HAVE_WEAK_ATTRIBUTE)
Packit Service c5cf8c
MPI_Aint MPI_Aint_add(MPI_Aint base, MPI_Aint disp) __attribute__ ((weak, alias("PMPI_Aint_add")));
Packit Service c5cf8c
#endif
Packit Service c5cf8c
/* -- End Profiling Symbol Block */
Packit Service c5cf8c
Packit Service c5cf8c
/* Define MPICH_MPI_FROM_PMPI if weak symbols are not supported to build
Packit Service c5cf8c
   the MPI routines */
Packit Service c5cf8c
#ifndef MPICH_MPI_FROM_PMPI
Packit Service c5cf8c
#undef MPI_Aint_add
Packit Service c5cf8c
#define MPI_Aint_add PMPI_Aint_add
Packit Service c5cf8c
Packit Service c5cf8c
#endif
Packit Service c5cf8c
Packit Service c5cf8c
#undef FUNCNAME
Packit Service c5cf8c
#define FUNCNAME MPI_Aint_add
Packit Service c5cf8c
Packit Service c5cf8c
/*@
Packit Service c5cf8c
MPI_Aint_add - Returns the sum of base and disp
Packit Service c5cf8c
Packit Service c5cf8c
Input Parameters:
Packit Service c5cf8c
+ base - base address (integer)
Packit Service c5cf8c
- disp - displacement (integer)
Packit Service c5cf8c
Packit Service c5cf8c
Return value:
Packit Service c5cf8c
Sum of the base and disp argument
Packit Service c5cf8c
Packit Service c5cf8c
Notes:
Packit Service c5cf8c
MPI_Aint_Add produces a new MPI_Aint value that is equivalent to the sum of the
Packit Service c5cf8c
base and disp arguments, where base represents a base address returned by a call
Packit Service c5cf8c
to MPI_GET_ADDRESS and disp represents a signed integer displacement. The resulting
Packit Service c5cf8c
address is valid only at the process that generated base, and it must correspond
Packit Service c5cf8c
to a location in the same object referenced by base. The addition is performed in
Packit Service c5cf8c
a manner that results in the correct MPI_Aint representation of the output address,
Packit Service c5cf8c
as if the process that originally produced base had called\:
Packit Service c5cf8c
.vb
Packit Service c5cf8c
    MPI_Get_address((char *) base + disp, &result)
Packit Service c5cf8c
.ve
Packit Service c5cf8c
Packit Service c5cf8c
.seealso: MPI_Aint_diff
Packit Service c5cf8c
@*/
Packit Service c5cf8c
Packit Service c5cf8c
MPI_Aint MPI_Aint_add(MPI_Aint base, MPI_Aint disp)
Packit Service c5cf8c
{
Packit Service c5cf8c
    MPI_Aint result;
Packit Service c5cf8c
    MPIR_FUNC_TERSE_STATE_DECL(MPID_STATE_MPI_AINT_ADD);
Packit Service c5cf8c
Packit Service c5cf8c
    MPIR_ERRTEST_INITIALIZED_ORDIE();
Packit Service c5cf8c
Packit Service c5cf8c
    MPIR_FUNC_TERSE_ENTER(MPID_STATE_MPI_AINT_ADD);
Packit Service c5cf8c
    result = MPID_Aint_add(base, disp);
Packit Service c5cf8c
    MPIR_FUNC_TERSE_EXIT(MPID_STATE_MPI_AINT_ADD);
Packit Service c5cf8c
Packit Service c5cf8c
    return result;
Packit Service c5cf8c
}