This library provides a suite of functions that do integer conversions between the native integer formats of different systems. Typically systems are classified as big-endian or little-endian.
Big-endian systems store their data with the most significant bytes of a multi-byte integer in lower addresses, while little-endian systems least significant bytes in lower addresses. This library uses signature data in the data to determine the byte ordering of foreign host (the host that created the data), and how it differs from the local byte ordering.
Signature data are data that have a known value, stored in the system's native byte order. Analyzing these values byte by byte allows the software to determine the byte order of the foreign system. The code defines the values: CVT_WORDSIGNATURE and CVT_LONGSIGNATURE respectively to be uint16_t and uint32_t signatures respectively. Separate 16 and 32 bit signatures allows the library to deal with any pathalogical systems that may have word orders that differ from byte ordering.
Creates a conversion block from the foreign system signatures you've
extracted from the data. Note that NSCLDAQ control data includes byte
and long signatures you can use for this purpose.
lsig
and
ssig
are the 32 and 16 bit signatures respectively.
conversion
must point to a DaqConversion structure that will be
over-written with the conversion block that describes how to
convert from the byte order described by
lsig
and
ssig
to the host's byte order.
Determines if the conversion block pointed to by
conversion
describes a system with the same byte order as the host system.
Converts a 32 bit value
datum
from the byte order of the foreign host used to produce the
DaqConversion
structer pointed to by convertdata
to the
local host's byte order. The converted value is returned.
Converts a 16 bit integer
datum
from the byte order described by
the system used to produce the
DaqConversion
block pointed to by
convertdata
into the local system's byte order
and returns that 16 bit integer.
Converts the 32 bit integer
datum
from the local host's native byte order to the byte order described
by the foreign host used to create the
DaqConversion
conversion block
convertdata
,
and returns the converted value.
Converts the 16 bit integer
datum
from the local host's native byte order to the byte order described
by the foreign host used to create the
DaqConversion
conversion block
convertdata
,
and returns the converted value.