General utilities.
More...
General utilities.
◆ ms_dabs
#define ms_dabs |
( |
| val | ) |
fabs(val) |
DEPRECATED legacy implementation of fabs(), now a macro
◆ ms_samplesize()
uint8_t ms_samplesize |
( |
char | sampletype | ) |
|
|
extern |
Determine data sample size for each type.
- Parameters
-
[in] | sampletype | Library sample type code:
't' - Text data type
'i' - 32-bit integer data type
'f' - 32-bit float data type
'd' - 64-bit float (double) data type
|
- Returns
- The sample size based on type code or 0 for unknown.
◆ ms_encoding_sizetype()
int ms_encoding_sizetype |
( |
uint8_t | encoding, |
|
|
uint8_t * | samplesize, |
|
|
char * | sampletype ) |
|
extern |
Return sample size and/or type for given encoding value.
Determine the decoded sample size and/or type based on data encoding. The samplesize and sampletype values will only be set if not NULL, allowing lookup of either value or both.
- Parameters
-
[in] | encoding | Data sample encoding code |
[out] | samplesize | Size of sample, pointer that will be set |
[out] | sampletype | Sample type, pointer to char that will be set |
- Returns
- 0 on success, -1 on error
◆ ms_encodingstr()
const char * ms_encodingstr |
( |
uint8_t | encoding | ) |
|
|
extern |
Descriptive string for data encodings.
- Parameters
-
[in] | encoding | Data sample encoding code |
- Returns
- a string describing a data encoding format
◆ ms_errorstr()
const char * ms_errorstr |
( |
int | errorcode | ) |
|
|
extern |
Descriptive string for library Return codes.
- Parameters
-
[in] | errorcode | Library error code |
- Returns
- a string describing the library error code or NULL if the code is unknown.
◆ ms_sampletime()
Calculate the time of a sample in an array.
Given a time, sample offset and sample rate/period calculate the time of the sample at the offset.
If samprate is negative the negated value is interpreted as a sample period in seconds, otherwise the value is assumed to be a sample rate in Hertz.
If leap seconds have been loaded into the internal library list: when a time span, from start to offset, completely contains a leap second, starts before and ends after, the calculated sample time will be adjusted (reduced) by one second.
- Note
- On the epoch time scale the value of a leap second is the same as the second following the leap second, without external information the values are ambiguous.
- See also
- ms_readleapsecondfile()
- Parameters
-
[in] | time | Time value for first sample in array |
[in] | offset | Offset of sample to calculate time of |
[in] | samprate | Sample rate (when positive) or period (when negative) |
- Returns
- Time of the sample at specified offset
◆ ms_bigendianhost()
int ms_bigendianhost |
( |
void | | ) |
|
|
externinline |
Runtime test for host endianess.
- Returns
- 0 if the host is little endian, otherwise 1.
◆ lmp_ftell64()
int64_t lmp_ftell64 |
( |
FILE * | stream | ) |
|
|
extern |
Portable version of POSIX ftello() to get file position in large files
◆ lmp_fseek64()
int lmp_fseek64 |
( |
FILE * | stream, |
|
|
int64_t | offset, |
|
|
int | whence ) |
|
extern |
Portable version of POSIX fseeko() to set position in large files
◆ lmp_nanosleep()
uint64_t lmp_nanosleep |
( |
uint64_t | nanoseconds | ) |
|
|
extern |
Portable version of POSIX nanosleep() to sleep for nanoseconds
◆ ms_crc32c()
uint32_t ms_crc32c |
( |
const uint8_t * | input, |
|
|
int | length, |
|
|
uint32_t | previousCRC32C ) |
|
extern |
Return CRC32C value of supplied buffer, with optional starting CRC32C value