/*
- * Copyright 2016 Facebook, Inc.
+ * Copyright 2017 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* limitations under the License.
*/
-#ifndef FOLLY_CHECKSUM_H_
-#define FOLLY_CHECKSUM_H_
+#pragma once
#include <stdint.h>
#include <cstddef>
uint32_t crc32c(const uint8_t* data, size_t nbytes,
uint32_t startingChecksum = ~0U);
-} // folly
+/**
+ * Compute the CRC-32 checksum of a buffer, using a hardware-accelerated
+ * implementation if available or a portable software implementation as
+ * a default.
+ */
+uint32_t
+crc32(const uint8_t* data, size_t nbytes, uint32_t startingChecksum = ~0U);
+
+/**
+ * Compute the CRC-32 checksum of a buffer, using a hardware-accelerated
+ * implementation if available or a portable software implementation as
+ * a default.
+ *
+ * @note compared to crc32(), crc32_type() uses a different set of default
+ * parameters to match the results returned by boost::crc_32_type and
+ * php's built-in crc32 implementation
+ */
+uint32_t
+crc32_type(const uint8_t* data, size_t nbytes, uint32_t startingChecksum = ~0U);
-#endif /* FOLLY_CHECKSUM_H_ */
+} // namespace folly