summaryrefslogtreecommitdiff
path: root/absl/crc/crc32c.h
diff options
context:
space:
mode:
authorGravatar Abseil Team <absl-team@google.com>2023-08-01 15:23:59 -0700
committerGravatar Copybara-Service <copybara-worker@google.com>2023-08-01 15:24:56 -0700
commite945c8d98719d2cca66ef1f0b83696becfa6a880 (patch)
tree29fca764686878fdf1381197ebedd634b3f45bb2 /absl/crc/crc32c.h
parentfc1dcc0f6a6b22f4ef4a30fc2020d4c81ab1b3c5 (diff)
Implement AbslStringify for crc32c_t in order to support absl::StrFormat natively
PiperOrigin-RevId: 552940359 Change-Id: I925764757404c0c9f2a13ed729190d51f4ac46cf
Diffstat (limited to 'absl/crc/crc32c.h')
-rw-r--r--absl/crc/crc32c.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/absl/crc/crc32c.h b/absl/crc/crc32c.h
index 69799c8b..362861e4 100644
--- a/absl/crc/crc32c.h
+++ b/absl/crc/crc32c.h
@@ -62,6 +62,11 @@ class crc32c_t final {
friend bool operator!=(crc32c_t lhs, crc32c_t rhs) { return !(lhs == rhs); }
+ template <typename Sink>
+ friend void AbslStringify(Sink& sink, crc32c_t crc) {
+ absl::Format(&sink, "%08x", static_cast<uint32_t>(crc));
+ }
+
private:
uint32_t crc_;
};