libacfutils
A general purpose library of utility functions designed to make it easier to develop addons for the X-Plane flight simulator.
Loading...
Searching...
No Matches
crc64.h
Go to the documentation of this file.
1/*
2 * CDDL HEADER START
3 *
4 * This file and its contents are supplied under the terms of the
5 * Common Development and Distribution License ("CDDL"), version 1.0.
6 * You may only use this file in accordance with the terms of version
7 * 1.0 of the CDDL.
8 *
9 * A full copy of the text of the CDDL should have accompanied this
10 * source. A copy of the CDDL is also available via the Internet at
11 * http://www.illumos.org/license/CDDL.
12 *
13 * CDDL HEADER END
14*/
15/*
16 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
17 */
18/*
19 * Copyright 2023 Saso Kiselkov. All rights reserved.
20 */
29#ifndef _ACF_UTILS_CRC64_H_
30#define _ACF_UTILS_CRC64_H_
31
32#include <stdlib.h>
33#include <stdint.h>
34
35#include "acfutils/assert.h"
36#include "acfutils/core.h"
37
38#ifdef __cplusplus
39extern "C" {
40#endif
41
42API_EXPORT void crc64_init(void);
43
47static inline void
48crc64_state_init(uint64_t *crc)
49{
50 ASSERT(crc != NULL);
51 *crc = (uint64_t)-1;
52}
53API_EXPORT void crc64_state_init_impl(uint64_t *crc);
54API_EXPORT uint64_t crc64_append(uint64_t crc, const void *input, size_t sz);
55API_EXPORT uint64_t crc64(const void *input, size_t sz);
56
57API_EXPORT void crc64_srand(uint64_t seed);
58API_EXPORT uint64_t crc64_rand(void);
59API_EXPORT double crc64_rand_fract(void);
60API_EXPORT double crc64_rand_normal(double sigma);
61
62#ifdef __cplusplus
63}
64#endif
65
66#endif /* _ACF_UTILS_CRC64_H_ */
#define ASSERT(x)
Definition assert.h:208
API_EXPORT uint64_t crc64(const void *input, size_t sz)
Definition crc64.c:65
API_EXPORT void crc64_state_init_impl(uint64_t *crc)
Definition crc64.c:51
API_EXPORT void crc64_srand(uint64_t seed)
Definition crc64.c:106
API_EXPORT void crc64_init(void)
Definition crc64.c:37
API_EXPORT uint64_t crc64_append(uint64_t crc, const void *input, size_t sz)
Definition crc64.c:88
API_EXPORT double crc64_rand_normal(double sigma)
Definition crc64.c:147
static void crc64_state_init(uint64_t *crc)
Definition crc64.h:48
API_EXPORT uint64_t crc64_rand(void)
Definition crc64.c:123
API_EXPORT double crc64_rand_fract(void)
Definition crc64.c:135