Low-level number conversion
These functions perform low-level number conversion. All of them expect single argument which must be data received from byte or bit reader. All of them return a number, which is the result of the requested conversion.
Name of each function consists of three parts:
In case the reader data was retrieved using the byte reader, all of these functions perform big-endian or little-endian byte reordering in accordance to the current byte-reorder mode set by Intel() or Motorola() functions. No byte reordering is done for reader data retrieved using the bit reader.
If bitness of reader data passed to these functions is greater than the requested output bitness, an error is generated. All functions extensively check the input data so if the reader data was somehow tampered with, an error may be generated.
Value = ToI8(ReaderData) Value = ToUI8(ReaderData) Value = ToI16(ReaderData) Value = ToUI16(ReaderData) Value = ToI32(ReaderData) Value = ToUI32(ReaderData) ValueLo, ValueHi = ToI64(ReaderData) ValueLo, ValueHi = ToUI64(ReaderData) Value = ToR32(ReaderData) Value = ToR64(ReaderData) Value = ToR80(ReaderData)
ToUI8(), ToUI16(), ToUI32() and ToUI64() functions simply expand read data to the requested number of bits and do not do any sign expansion by setting the non-present upper bits to zero. Therefore, they always produce positive numbers.
ToI8(), ToI16(), ToI32() and ToI64() functions along with bitness expansion perform propagation of the most significant bit of the reader data to the upper bits of the resulting number, thus producing signed numbers.
ToI64() and ToUI64() functions actually return two 32-bit wide numbers: the first one is the low part of the whole 64-bit wide number, the second one is the high part.
ToR32(), ToR64() and ToR80() functions do not perform any bitness expansion or sign extension and expect the corresponding number of bits to be present in the reader data. However, they perform byte reordering as directed by Intel() or Motorola() functions. These functions are direct equivalents of float, double and long double C data types correspondingy.
ToR80() function internally casts its output (C long double type) to C double type so if the number is really big and does not fit the double range, an erroneous data may be returned.
You rarely need to use these functions. Instead, you will use the corresponding Peek...() and Get...() functions much more frequently.