|
Packit Service |
c5cf8c |
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
|
|
Packit Service |
c5cf8c |
/*
|
|
Packit Service |
c5cf8c |
* (C) 2001 by Argonne National Laboratory.
|
|
Packit Service |
c5cf8c |
* See COPYRIGHT in top-level directory.
|
|
Packit Service |
c5cf8c |
*/
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#ifndef MPIR_TYPE_DEFS_H_INCLUDED
|
|
Packit Service |
c5cf8c |
#define MPIR_TYPE_DEFS_H_INCLUDED
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#include "mpichconf.h"
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Basic typedefs */
|
|
Packit Service |
c5cf8c |
#ifdef HAVE_SYS_BITYPES_H
|
|
Packit Service |
c5cf8c |
#include <sys/bitypes.h>
|
|
Packit Service |
c5cf8c |
#endif
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* inttypes.h is supposed to include stdint.h but this is here as
|
|
Packit Service |
c5cf8c |
belt-and-suspenders for platforms that aren't fully compliant */
|
|
Packit Service |
c5cf8c |
#ifdef HAVE_INTTYPES_H
|
|
Packit Service |
c5cf8c |
#include <inttypes.h>
|
|
Packit Service |
c5cf8c |
#endif
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* stdint.h gives us fixed-width C99 types like int16_t, among others */
|
|
Packit Service |
c5cf8c |
#ifdef HAVE_STDINT_H
|
|
Packit Service |
c5cf8c |
#include <stdint.h>
|
|
Packit Service |
c5cf8c |
#endif
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* stdbool.h gives us the C boolean type */
|
|
Packit Service |
c5cf8c |
#ifdef HAVE_STDBOOL_H
|
|
Packit Service |
c5cf8c |
#include <stdbool.h>
|
|
Packit Service |
c5cf8c |
#endif
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* complex.h gives us the C complex type */
|
|
Packit Service |
c5cf8c |
#ifdef HAVE_COMPLEX_H
|
|
Packit Service |
c5cf8c |
#include <complex.h>
|
|
Packit Service |
c5cf8c |
#endif
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#ifdef HAVE_WINDOWS_H
|
|
Packit Service |
c5cf8c |
#include <winsock2.h>
|
|
Packit Service |
c5cf8c |
#include <windows.h>
|
|
Packit Service |
c5cf8c |
#else
|
|
Packit Service |
c5cf8c |
#ifndef BOOL
|
|
Packit Service |
c5cf8c |
#define BOOL int
|
|
Packit Service |
c5cf8c |
#endif
|
|
Packit Service |
c5cf8c |
#endif
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#include "mpl.h"
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Use the MPIR_PtrToXXX macros to convert pointers to and from integer types */
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* The Microsoft compiler will not allow casting of different sized types
|
|
Packit Service |
c5cf8c |
* without
|
|
Packit Service |
c5cf8c |
* printing a compiler warning. Using these macros allows compiler specific
|
|
Packit Service |
c5cf8c |
* type casting and avoids the warning output. These macros should only be used
|
|
Packit Service |
c5cf8c |
* in code that can handle loss of bits.
|
|
Packit Service |
c5cf8c |
*/
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* PtrToAint converts a pointer to an MPI_Aint type, truncating bits if necessary */
|
|
Packit Service |
c5cf8c |
#ifdef HAVE_PTRTOAINT
|
|
Packit Service |
c5cf8c |
#define MPIR_Ptr_to_aint(a) ((MPI_Aint)(INT_PTR) (a))
|
|
Packit Service |
c5cf8c |
#else
|
|
Packit Service |
c5cf8c |
/* An MPI_Aint may be *larger* than a pointer. By using 2 casts, we can
|
|
Packit Service |
c5cf8c |
keep some compilers from complaining about converting a pointer to an
|
|
Packit Service |
c5cf8c |
integer of a different size */
|
|
Packit Service |
c5cf8c |
#define MPIR_Ptr_to_aint(a) ((MPI_Aint)(uintptr_t)(a))
|
|
Packit Service |
c5cf8c |
#endif
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* AintToPtr converts an MPI_Aint to a pointer type, extending bits if necessary */
|
|
Packit Service |
c5cf8c |
#ifdef HAVE_AINTTOPTR
|
|
Packit Service |
c5cf8c |
#define MPIR_Aint_to_ptr(a) ((VOID *)(INT_PTR)((MPI_Aint)a))
|
|
Packit Service |
c5cf8c |
#else
|
|
Packit Service |
c5cf8c |
#define MPIR_Aint_to_ptr(a) (void*)(a)
|
|
Packit Service |
c5cf8c |
#endif
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Adding the 32-bit compute/64-bit I/O related type-casts in here as
|
|
Packit Service |
c5cf8c |
* they are not a part of the MPI standard yet. */
|
|
Packit Service |
c5cf8c |
#define MPIR_AINT_CAST_TO_VOID_PTR (void *)(intptr_t)
|
|
Packit Service |
c5cf8c |
#define MPIR_VOID_PTR_CAST_TO_MPI_AINT (MPI_Aint)(uintptr_t)
|
|
Packit Service |
c5cf8c |
#define MPIR_PTR_DISP_CAST_TO_MPI_AINT (MPI_Aint)(intptr_t)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#endif /* MPIR_TYPE_DEFS_H_INCLUDED */
|