Android-cuttlefish cvd tool
crc32c.h
Go to the documentation of this file.
1#include "crc32c/crc32c.h"
2
3// /* Copyright 2017 The CRC32C Authors. All rights reserved.
4// Use of this source code is governed by a BSD-style license that can be
5// found in the LICENSE file. See the AUTHORS file for names of contributors. */
6//
7// #ifndef CRC32C_CRC32C_H_
8// #define CRC32C_CRC32C_H_
9//
10// /* The API exported by the CRC32C project. */
11//
12// #if defined(__cplusplus)
13//
14// #include <cstddef>
15// #include <cstdint>
16// #include <string>
17//
18// #else /* !defined(__cplusplus) */
19//
20// #include <stddef.h>
21// #include <stdint.h>
22//
23// #endif /* !defined(__cplusplus) */
24//
25//
26// /* The C API. */
27//
28// #if defined(__cplusplus)
29// extern "C" {
30// #endif /* defined(__cplusplus) */
31//
32// /* Extends "crc" with the CRC32C of "count" bytes in the buffer pointed by
33// "data" */
34// uint32_t crc32c_extend(uint32_t crc, const uint8_t* data, size_t count);
35//
36// /* Computes the CRC32C of "count" bytes in the buffer pointed by "data". */
37// uint32_t crc32c_value(const uint8_t* data, size_t count);
38//
39// #ifdef __cplusplus
40// } /* end extern "C" */
41// #endif /* defined(__cplusplus) */
42//
43//
44// /* The C++ API. */
45//
46// #if defined(__cplusplus)
47//
48// namespace crc32c {
49//
50// // Extends "crc" with the CRC32C of "count" bytes in the buffer pointed by
51// // "data".
52// uint32_t Extend(uint32_t crc, const uint8_t* data, size_t count);
53//
54// // Computes the CRC32C of "count" bytes in the buffer pointed by "data".
55// inline uint32_t Crc32c(const uint8_t* data, size_t count) {
56// return Extend(0, data, count);
57// }
58//
59// // Computes the CRC32C of "count" bytes in the buffer pointed by "data".
60// inline uint32_t Crc32c(const char* data, size_t count) {
61// return Extend(0, reinterpret_cast<const uint8_t*>(data), count);
62// }
63//
64// // Computes the CRC32C of the string's content.
65// inline uint32_t Crc32c(const std::string& string) {
66// return Crc32c(reinterpret_cast<const uint8_t*>(string.data()),
67// string.size());
68// }
69//
70// } // namespace crc32c
71//
72// #if __cplusplus > 201402L
73// #if __has_include(<string_view>)
74// #include <string_view>
75//
76// namespace crc32c {
77//
78// // Computes the CRC32C of the bytes in the string_view.
79// inline uint32_t Crc32c(const std::string_view& string_view) {
80// return Crc32c(reinterpret_cast<const uint8_t*>(string_view.data()),
81// string_view.size());
82// }
83//
84// } // namespace crc32c
85//
86// #endif // __has_include(<string_view>)
87// #endif // __cplusplus > 201402L
88//
89// #endif /* defined(__cplusplus) */
90//
91// #endif // CRC32C_CRC32C_H_