Skip to main content
`Ctrl`+`K`

# PetscIntCast

casts a `MPI_Count`, `PetscInt64`, `PetscCount`, or `size_t` to a `PetscInt` (which may be 32-bits in size), generates an error if the `PetscInt` is not large enough to hold the number.

## Synopsis

    static inline PetscErrorCode PetscIntCast(MPIU_Count a, PetscInt *b)

Not Collective; No Fortran Support

## Input Parameter

- a - the `PetscInt64` value

## Output Parameter

- b - the resulting `PetscInt` value, or `NULL` if the result is not needed

## Note

If integers needed for the applications are too large to fit in 32-bit ints you can ./configure using `--with-64-bit-indices` to make `PetscInt` use 64-bit integers

## See Also

`PetscBLASInt`, `PetscMPIInt`, `PetscInt`, `PetscMPIIntCast()`, `PetscBLASIntCast()`, `PetscCIntCast()`, `PetscIntMultError()`, `PetscIntSumError()`

## Level

advanced

## Location

include/petscsys.h

Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages