pw_bytes: add helper user defined literals
Adds helper literals including _B, _KiB, _MiB, _GiB, _TiB, _PiB,
and _EiB to define a number of bytes.
Change-Id: I8aa5eae85eb84dd2f071ff1e24e630b9c35f1418
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/55682
Reviewed-by: Wyatt Hepler <hepler@google.com>
Pigweed-Auto-Submit: Ewout van Bekkum <ewout@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
diff --git a/pw_bytes/BUILD.gn b/pw_bytes/BUILD.gn
index 1b98997..554fda1 100644
--- a/pw_bytes/BUILD.gn
+++ b/pw_bytes/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2020 The Pigweed Authors
+# Copyright 2021 The Pigweed Authors
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
@@ -31,6 +31,7 @@
"public/pw_bytes/byte_builder.h",
"public/pw_bytes/endian.h",
"public/pw_bytes/span.h",
+ "public/pw_bytes/units.h",
]
sources = [ "byte_builder.cc" ]
public_deps = [
@@ -44,6 +45,7 @@
":array_test",
":byte_builder_test",
":endian_test",
+ ":units_test",
]
group_deps = [
"$dir_pw_preprocessor:tests",
@@ -66,6 +68,11 @@
sources = [ "endian_test.cc" ]
}
+pw_test("units_test") {
+ deps = [ ":pw_bytes" ]
+ sources = [ "units_test.cc" ]
+}
+
pw_doc_group("docs") {
sources = [ "docs.rst" ]
report_deps = [ ":byte_builder_size_report" ]