Wheefun I/O Library  0.0.5
Useful I/O Primitives.
Functions
byteswap.h File Reference

Byte-swapping functions. More...

#include <wfio/type.h>

Go to the source code of this file.

Functions

WFIO_INLINE wfio_sint16_t wfio_swapSI16 (wfio_sint16_t src)
 Perform a byte swap on a 16-bit signed integer. More...
 
WFIO_DLL void wfio_swapSI16V2 (const wfio_sint16_t *src, wfio_sint16_t *dest, size_t len)
 Perform a byte swap on 16-bit signed integers in src to be stored in dest. More...
 
WFIO_ALWAYS_INLINE void wfio_swapSI16V (wfio_sint16_t *buf, size_t len)
 Perform a byte swap on 16-bit signed integers in buf. More...
 
WFIO_ALWAYS_INLINE wfio_sint16_t wfio_swapUI16 (wfio_sint16_t src)
 Perform a byte swap on a 16-bit unsigned integer. More...
 
WFIO_ALWAYS_INLINE void wfio_swapUI16V2 (const wfio_sint16_t *src, wfio_sint16_t *dest, size_t len)
 Perform a byte swap on 16-bit unsigned integers in src to be stored in dest. More...
 
WFIO_ALWAYS_INLINE void wfio_swapUI16V (wfio_sint16_t *buf, size_t len)
 Perform a byte swap on 16-bit unsigned integers in buf. More...
 
WFIO_MAYBE_INLINE wfio_sint32_t wfio_swapSI32 (wfio_sint32_t src)
 Perform a byte swap on a 32-bit signed integer. More...
 
WFIO_DLL void wfio_swapSI32V2 (const wfio_sint32_t *src, wfio_sint32_t *dest, size_t len)
 Perform a byte swap on 32-bit signed integers in src to be stored in dest. More...
 
WFIO_ALWAYS_INLINE void wfio_swapSI32V (wfio_sint32_t *buf, size_t len)
 Perform a byte swap on 32-bit signed integers in buf. More...
 
WFIO_ALWAYS_INLINE wfio_sint32_t wfio_swapUI32 (wfio_sint32_t src)
 Perform a byte swap on a 32-bit signed integer. More...
 
WFIO_ALWAYS_INLINE void wfio_swapUI32V2 (const wfio_sint32_t *src, wfio_sint32_t *dest, size_t len)
 Perform a byte swap on 32-bit unsigned integers in src to be stored in dest. More...
 
WFIO_ALWAYS_INLINE void wfio_swapUI32V (wfio_sint32_t *buf, size_t len)
 Perform a byte swap on 32-bit unsigned integers in buf. More...
 
WFIO_MAYBE_INLINE wfio_sint64_t wfio_swapSI64 (wfio_sint64_t src)
 Perform a byte swap on a 64-bit signed integer. More...
 
WFIO_DLL void wfio_swapSI64V2 (const wfio_sint64_t *src, wfio_sint64_t *dest, size_t len)
 Perform a byte swap on 64-bit signed integers in src to be stored in dest. More...
 
WFIO_ALWAYS_INLINE void wfio_swapSI64V (wfio_sint64_t *buf, size_t len)
 Perform a byte swap on 64-bit signed integers in buf. More...
 
WFIO_ALWAYS_INLINE wfio_sint64_t wfio_swapUI64 (wfio_sint64_t src)
 Perform a byte swap on a 64-bit unsigned integer. More...
 
WFIO_ALWAYS_INLINE void wfio_swapUI64V2 (const wfio_sint64_t *src, wfio_sint64_t *dest, size_t len)
 Perform a byte swap on 64-bit unsigned integers in src to be stored in dest. More...
 
WFIO_ALWAYS_INLINE void wfio_swapUI64V (wfio_sint64_t *buf, size_t len)
 Perform a byte swap on 64-bit unsigned integers in buf. More...
 

Detailed Description

Byte-swapping functions.

Author
Phillip Kilgore
Since
0.0.1

Function Documentation

◆ wfio_swapSI16()

WFIO_INLINE wfio_sint16_t wfio_swapSI16 ( wfio_sint16_t  src)

Perform a byte swap on a 16-bit signed integer.

This function can be used to swap the endianness of a 16-bit signed integer. It does not take into account whether or not the integer is already in the host endianness.

Parameters
srcThe integer to swap endianness for.
Returns
The byte-swapped value.

◆ wfio_swapSI16V()

WFIO_ALWAYS_INLINE void wfio_swapSI16V ( wfio_sint16_t *  buf,
size_t  len 
)

Perform a byte swap on 16-bit signed integers in buf.

This function can be used to swap the endianness of a vector of 16-bit signed integers. It does not take into account whether or not the integer is already in the host endianness. The swapped integers will read from src, have their endianness swapped, and will be stored into their corresponding positions in dest; src and dest may be the same buffer.

Parameters
bufAn array of integers to swap endianess of.
lenThe number of integers to process.
Precondition
buf is not null
Postcondition
The values in buf shall have their endiannes swapped from the values originally passed.

◆ wfio_swapSI16V2()

WFIO_DLL void wfio_swapSI16V2 ( const wfio_sint16_t *  src,
wfio_sint16_t *  dest,
size_t  len 
)

Perform a byte swap on 16-bit signed integers in src to be stored in dest.

This function can be used to swap the endianness of a vector of 16-bit signed integers. It does not take into account whether or not the integer is already in the host endianness. The swapped integers will read from src, have their endianness swapped, and will be stored into their corresponding positions in dest; src and dest may be the same buffer.

Parameters
srcAn array of integers to read from.
destAn array of integers to write to.
lenThe number of integers to process.
Precondition
Neither src or dest are null.
Postcondition
The values in dest shall have their endiannes swapped from the values originally passed in src.

◆ wfio_swapSI32()

WFIO_MAYBE_INLINE wfio_sint32_t wfio_swapSI32 ( wfio_sint32_t  src)

Perform a byte swap on a 32-bit signed integer.

This function can be used to swap the endianness of a 32-bit signed integer. It does not take into account whether or not the integer is already in the host endianness.

Parameters
srcThe integer to swap endianness for.
Returns
The byte-swapped value.

◆ wfio_swapSI32V()

WFIO_ALWAYS_INLINE void wfio_swapSI32V ( wfio_sint32_t *  buf,
size_t  len 
)

Perform a byte swap on 32-bit signed integers in buf.

This function can be used to swap the endianness of a vector of 32-bit signed integers. It does not take into account whether or not the integer is already in the host endianness. The swapped integers will read from src, have their endianness swapped, and will be stored into their corresponding positions in dest; src and dest may be the same buffer.

Parameters
bufAn array of integers to swap endianess of.
lenThe number of integers to process.
Precondition
buf is not null
Postcondition
The values in buf shall have their endiannes swapped from the values originally passed.

◆ wfio_swapSI32V2()

WFIO_DLL void wfio_swapSI32V2 ( const wfio_sint32_t *  src,
wfio_sint32_t *  dest,
size_t  len 
)

Perform a byte swap on 32-bit signed integers in src to be stored in dest.

This function can be used to swap the endianness of a vector of 32-bit signed integers. It does not take into account whether or not the integer is already in the host endianness. The swapped integers will read from src, have their endianness swapped, and will be stored into their corresponding positions in dest; src and dest may be the same buffer.

Parameters
srcAn array of integers to read from.
destAn array of integers to write to.
lenThe number of integers to process.
Precondition
Neither src or dest are null.
Postcondition
The values in dest shall have their endiannes swapped from the values originally passed in src.

◆ wfio_swapSI64()

WFIO_MAYBE_INLINE wfio_sint64_t wfio_swapSI64 ( wfio_sint64_t  src)

Perform a byte swap on a 64-bit signed integer.

This function can be used to swap the endianness of a 64-bit signed integer. It does not take into account whether or not the integer is already in the host endianness.

Parameters
srcThe integer to swap endianness for.
Returns
The byte-swapped value.

◆ wfio_swapSI64V()

WFIO_ALWAYS_INLINE void wfio_swapSI64V ( wfio_sint64_t *  buf,
size_t  len 
)

Perform a byte swap on 64-bit signed integers in buf.

This function can be used to swap the endianness of a vector of 64-bit signed integers. It does not take into account whether or not the integer is already in the host endianness. The swapped integers will read from src, have their endianness swapped, and will be stored into their corresponding positions in dest; src and dest may be the same buffer.

Parameters
bufAn array of integers to swap endianess of.
lenThe number of integers to process.
Precondition
buf is not null
Postcondition
The values in buf shall have their endiannes swapped from the values originally passed.

◆ wfio_swapSI64V2()

WFIO_DLL void wfio_swapSI64V2 ( const wfio_sint64_t *  src,
wfio_sint64_t *  dest,
size_t  len 
)

Perform a byte swap on 64-bit signed integers in src to be stored in dest.

This function can be used to swap the endianness of a vector of 64-bit signed integers. It does not take into account whether or not the integer is already in the host endianness. The swapped integers will read from src, have their endianness swapped, and will be stored into their corresponding positions in dest; src and dest may be the same buffer.

Parameters
srcAn array of integers to read from.
destAn array of integers to write to.
lenThe number of integers to process.
Precondition
Neither src or dest are null.
Postcondition
The values in dest shall have their endiannes swapped from the values originally passed in src.

◆ wfio_swapUI16()

WFIO_ALWAYS_INLINE wfio_sint16_t wfio_swapUI16 ( wfio_sint16_t  src)

Perform a byte swap on a 16-bit unsigned integer.

This function can be used to swap the endianness of a 16-bit unsigned integer. It does not take into account whether or not the integer is already in the host endianness.

Parameters
srcThe integer to swap endianness for.
Returns
The byte-swapped value.

◆ wfio_swapUI16V()

WFIO_ALWAYS_INLINE void wfio_swapUI16V ( wfio_sint16_t *  buf,
size_t  len 
)

Perform a byte swap on 16-bit unsigned integers in buf.

This function can be used to swap the endianness of a vector of 16-bit unsigned integers. It does not take into account whether or not the integer is already in the host endianness. The swapped integers will read from src, have their endianness swapped, and will be stored into their corresponding positions in dest; src and dest may be the same buffer.

Parameters
bufAn array of integers to swap endianess of.
lenThe number of integers to process.
Precondition
buf is not null
Postcondition
The values in buf shall have their endiannes swapped from the values originally passed.

◆ wfio_swapUI16V2()

WFIO_ALWAYS_INLINE void wfio_swapUI16V2 ( const wfio_sint16_t *  src,
wfio_sint16_t *  dest,
size_t  len 
)

Perform a byte swap on 16-bit unsigned integers in src to be stored in dest.

This function can be used to swap the endianness of a vector of 16-bit unsigned integers. It does not take into account whether or not the integer is already in the host endianness. The swapped integers will read from src, have their endianness swapped, and will be stored into their corresponding positions in dest; src and dest may be the same buffer.

Parameters
srcAn array of integers to read from.
destAn array of integers to write to.
lenThe number of integers to process.
Precondition
Neither src or dest are null.
Postcondition
The values in dest shall have their endiannes swapped from the values originally passed in src.

◆ wfio_swapUI32()

WFIO_ALWAYS_INLINE wfio_sint32_t wfio_swapUI32 ( wfio_sint32_t  src)

Perform a byte swap on a 32-bit signed integer.

This function can be used to swap the endianness of a 32-bit unsigned integer. It does not take into account whether or not the integer is already in the host endianness.

Parameters
srcThe integer to swap endianness for.
Returns
The byte-swapped value.

◆ wfio_swapUI32V()

WFIO_ALWAYS_INLINE void wfio_swapUI32V ( wfio_sint32_t *  buf,
size_t  len 
)

Perform a byte swap on 32-bit unsigned integers in buf.

This function can be used to swap the endianness of a vector of 32-bit unsigned integers. It does not take into account whether or not the integer is already in the host endianness. The swapped integers will read from src, have their endianness swapped, and will be stored into their corresponding positions in dest; src and dest may be the same buffer.

Parameters
bufAn array of integers to swap endianess of.
lenThe number of integers to process.
Precondition
buf is not null
Postcondition
The values in buf shall have their endiannes swapped from the values originally passed.

◆ wfio_swapUI32V2()

WFIO_ALWAYS_INLINE void wfio_swapUI32V2 ( const wfio_sint32_t *  src,
wfio_sint32_t *  dest,
size_t  len 
)

Perform a byte swap on 32-bit unsigned integers in src to be stored in dest.

This function can be used to swap the endianness of a vector of 32-bit unsigned integers. It does not take into account whether or not the integer is already in the host endianness. The swapped integers will read from src, have their endianness swapped, and will be stored into their corresponding positions in dest; src and dest may be the same buffer.

Parameters
srcAn array of integers to read from.
destAn array of integers to write to.
lenThe number of integers to process.
Precondition
Neither src or dest are null.
Postcondition
The values in dest shall have their endiannes swapped from the values originally passed in src.

◆ wfio_swapUI64()

WFIO_ALWAYS_INLINE wfio_sint64_t wfio_swapUI64 ( wfio_sint64_t  src)

Perform a byte swap on a 64-bit unsigned integer.

This function can be used to swap the endianness of a 64-bit unsigned integer. It does not take into account whether or not the integer is already in the host endianness.

Parameters
srcThe integer to swap endianness for.
Returns
The byte-swapped value.

◆ wfio_swapUI64V()

WFIO_ALWAYS_INLINE void wfio_swapUI64V ( wfio_sint64_t *  buf,
size_t  len 
)

Perform a byte swap on 64-bit unsigned integers in buf.

This function can be used to swap the endianness of a vector of 64-bit unsigned integers. It does not take into account whether or not the integer is already in the host endianness. The swapped integers will read from src, have their endianness swapped, and will be stored into their corresponding positions in dest; src and dest may be the same buffer.

Parameters
bufAn array of integers to swap endianess of.
lenThe number of integers to process.
Precondition
buf is not null
Postcondition
The values in buf shall have their endiannes swapped from the values originally passed.

◆ wfio_swapUI64V2()

WFIO_ALWAYS_INLINE void wfio_swapUI64V2 ( const wfio_sint64_t *  src,
wfio_sint64_t *  dest,
size_t  len 
)

Perform a byte swap on 64-bit unsigned integers in src to be stored in dest.

This function can be used to swap the endianness of a vector of 64-bit unsigned integers. It does not take into account whether or not the integer is already in the host endianness. The swapped integers will read from src, have their endianness swapped, and will be stored into their corresponding positions in dest; src and dest may be the same buffer.

Parameters
srcAn array of integers to read from.
destAn array of integers to write to.
lenThe number of integers to process.
Precondition
Neither src or dest are null.
Postcondition
The values in dest shall have their endiannes swapped from the values originally passed in src.