Skip to content

Commit 9d0fb14

Browse files
authored
C++ interface: Support std::byte if it's available. (#60)
1 parent 21fc8ef commit 9d0fb14

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

include/crc32c/crc32c.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,13 @@ inline uint32_t Crc32c(const char* data, size_t count) {
5959
return Extend(0, reinterpret_cast<const uint8_t*>(data), count);
6060
}
6161

62+
#ifdef __cpp_lib_byte
63+
// Computes the CRC32C of "count" bytes in the buffer pointed by "data".
64+
inline uint32_t Crc32c(const std::byte* data, size_t count) {
65+
return Extend(0, reinterpret_cast<const uint8_t*>(data), count);
66+
}
67+
#endif
68+
6269
// Computes the CRC32C of the string's content.
6370
inline uint32_t Crc32c(const std::string& string) {
6471
return Crc32c(reinterpret_cast<const uint8_t*>(string.data()),

0 commit comments

Comments
 (0)