libacfutils
A general purpose library of utility functions designed to make it easier to develop addons for the X-Plane flight simulator.
|
Go to the source code of this file.
Functions | |
API_EXPORT void | crc64_init (void) |
static void | crc64_state_init (uint64_t *crc) |
API_EXPORT void | crc64_state_init_impl (uint64_t *crc) |
API_EXPORT uint64_t | crc64_append (uint64_t crc, const void *input, size_t sz) |
API_EXPORT uint64_t | crc64 (const void *input, size_t sz) |
API_EXPORT void | crc64_srand (uint64_t seed) |
API_EXPORT uint64_t | crc64_rand (void) |
API_EXPORT double | crc64_rand_fract (void) |
API_EXPORT double | crc64_rand_normal (double sigma) |
A generic CRC64 implementation from OpenSolaris. Be sure to call crc64_init() before using it. Then just call crc64() and pass it the data you want checksummed. Also includes a fast & light-weight portable pseudo random number generator.
Definition in file crc64.h.
API_EXPORT uint64_t crc64 | ( | const void * | input, |
size_t | sz | ||
) |
API_EXPORT uint64_t crc64_append | ( | uint64_t | crc, |
const void * | input, | ||
size_t | sz | ||
) |
This is similar to crc64(), but allows you to compute the checksum in pieces.
crc | Previous state of the checksum. On first call, you must initialize this using crc64_state_init(). Then, pass the previous output of crc64_append() here, gradually updating it as the checksum process proceeds. |
input | The input data block for which the CRC64 checksum should be computed. |
sz | Number of bytes in input to be checksummed. |
crc
argument of the next crc64_append() call. API_EXPORT void crc64_init | ( | void | ) |
API_EXPORT uint64_t crc64_rand | ( | void | ) |
Grabs a random 64-bit number from the PRNG. This function isn't thread-safe, so take care not to rely on its output being super-duper unpredictable in multi-threade apps. You shouldn't be relying on it for anything more than lightweight randomness duties which need to be fast above everything else.
DO NOT use this for cryptographically secure randomness operations (e.g. generating encryption key material). See osrand.h for a high-quality PRNG.
API_EXPORT double crc64_rand_fract | ( | void | ) |
API_EXPORT double crc64_rand_normal | ( | double | sigma | ) |
API_EXPORT void crc64_srand | ( | uint64_t | seed | ) |
|
inlinestatic |
Initializes the starting CRC64 value for subsequent calls to crc64_append().
API_EXPORT void crc64_state_init_impl | ( | uint64_t * | crc | ) |
Same as crc64_state_init(), but provided for linkage for Rust bridge.