aint_diff.c 2.11 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
/*
 *
 *  (C) 2014 by Argonne National Laboratory.
 *      See COPYRIGHT in top-level directory.
 */

#include "mpiimpl.h"

/* -- Begin Profiling Symbol Block for routine MPIX_Aint_diff */
#if defined(HAVE_PRAGMA_WEAK)
#pragma weak MPIX_Aint_diff = PMPIX_Aint_diff
#elif defined(HAVE_PRAGMA_HP_SEC_DEF)
#pragma _HP_SECONDARY_DEF PMPIX_Aint_diff  MPIX_Aint_diff
#elif defined(HAVE_PRAGMA_CRI_DUP)
#pragma _CRI duplicate MPIX_Aint_diff as PMPIX_Aint_diff
#elif defined(HAVE_WEAK_ATTRIBUTE)
MPI_Aint MPIX_Aint_diff(MPI_Aint addr1, MPI_Aint addr2) __attribute__((weak,alias("PMPIX_Aint_diff")));
#endif
/* -- End Profiling Symbol Block */

/* Define MPICH_MPI_FROM_PMPI if weak symbols are not supported to build
   the MPI routines */
#ifndef MPICH_MPI_FROM_PMPI
#undef MPIX_Aint_diff
#define MPIX_Aint_diff PMPIX_Aint_diff

#endif

#undef FUNCNAME
#define FUNCNAME MPIX_Aint_diff

/*@
MPIX_Aint_diff - Returns the difference between addr1 and addr2

Input Parameters:
+ addr1 - minuend address (integer)
- addr2 - subtrahend address (integer)

Return value:
Difference between addr1 and addr2

Notes:
MPIX_Aint_diff produces a new MPI_Aint value that is equivalent to the difference
between addr1 and addr2 arguments, where addr1 and addr2 represent addresses
returned by calls to MPI_GET_ADDRESS. The resulting address is valid only at the
process that generated addr1 and addr2, and addr1 and addr2 must correspond to
locations in the same object in the same process. The difference is calculated
in a manner that results the signed difference from addr1 to addr2, as if the
process that originally produced the addresses had called
    (char *) addr1 - (char *) addr2
on the addresses initially passed to MPI_GET_ADDRESS.

.seealso: MPIX_Aint_add
@*/

MPI_Aint MPIX_Aint_diff(MPI_Aint addr1, MPI_Aint addr2)
{
    MPI_Aint result;
    MPID_MPI_STATE_DECL(MPID_STATE_MPIX_AINT_DIFF);

    MPIR_ERRTEST_INITIALIZED_ORDIE();

    MPID_MPI_FUNC_ENTER(MPID_STATE_MPIX_AINT_DIFF);
    result = MPID_Aint_diff(addr1, addr2);
    MPID_MPI_FUNC_EXIT(MPID_STATE_MPIX_AINT_DIFF);

    return result;
}