Skip to main content
`Ctrl`+`K`

# PetscByteSwap

Reverse the byte order of an array of values of a given `PetscDataType`, in place

## Synopsis

    PetscErrorCode PetscByteSwap(void *data, PetscDataType pdtype, PetscCount count)

Not Collective; No Fortran Support

## Input Parameters

- data - the array of values to byte-swap in place

- pdtype - the `PetscDataType` of the values (e.g. `PETSC_INT`, `PETSC_REAL`, `PETSC_SCALAR`)

- count - number of values in `data`

## Note

Used by binary I/O routines to convert between little-endian and big-endian representations.

## See Also

`PetscDataType`, `PetscViewerBinaryRead()`, `PetscViewerBinaryWrite()`

## Level

developer

## Location

src/sys/fileio/sysio.c

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