chsvlib
chsv helper source code

◆ fast_bswap()

T Chusov::Memory::fast_bswap ( const T &  datum)
noexcept

Performs fast inversion of a byte sequence within a datum using processor intrinsics, if possible.

Template Parameters
TA type of the datum.
Parameters
datumThe datum.
Returns
The result.

In the generic case, i.e. when known intrinsics used for byte swapping are not available, the function performs a slow byte-per-byte operation.