summaryrefslogtreecommitdiff
path: root/absl/strings/internal/cord_internal.h
diff options
context:
space:
mode:
authorGravatar Abseil Team <absl-team@google.com>2021-05-06 20:08:01 -0700
committerGravatar Andy Getz <durandal@google.com>2021-05-07 13:51:04 -0400
commit079cf662544a14bd1cfaae6d6512645541ba10fb (patch)
tree99d164c0162508aa69ace6879d9a36f89e145065 /absl/strings/internal/cord_internal.h
parent70b29fe5a5c1752158830eabc9aa273718b477af (diff)
Export of internal Abseil changes
-- 51e9291d9bc385082b4061fe760b236ba59c79c3 by Abseil Team <absl-team@google.com>: Cast to uint64_t using braces instead of parentheses. PiperOrigin-RevId: 372475909 -- 939fc409855da2639dcaf2d1d4971ca0e0568d03 by Martijn Vels <mvels@google.com>: Expand # flat nodes into size detailed counters. PiperOrigin-RevId: 372474608 -- 54b158c99b32f8a14821ce74fed0f9f836525ce7 by Martijn Vels <mvels@google.com>: Make copies of sampled cords sampled as well This applies to the following methods: - Cord(const Cord&) - operator=(const Cord&) - Subcord(...) PiperOrigin-RevId: 372468160 -- 876c2581ce008871464e8b471efbb967d150f83b by Andy Getzendanner <durandal@google.com>: Document the type of an ABSL_FLAGS.OnUpdate() callback. PiperOrigin-RevId: 372406390 GitOrigin-RevId: 51e9291d9bc385082b4061fe760b236ba59c79c3 Change-Id: Ifb75122cae56b66c28128aee90a63bbb28d93817
Diffstat (limited to 'absl/strings/internal/cord_internal.h')
-rw-r--r--absl/strings/internal/cord_internal.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/absl/strings/internal/cord_internal.h b/absl/strings/internal/cord_internal.h
index c7ae0104..813b3f35 100644
--- a/absl/strings/internal/cord_internal.h
+++ b/absl/strings/internal/cord_internal.h
@@ -366,6 +366,16 @@ class InlineData {
return as_tree_.cordz_info != kNullCordzInfo;
}
+ // Returns true if either of the provided instances hold a cordz_info value.
+ // This method is more efficient than the equivalent `data1.is_profiled() ||
+ // data2.is_profiled()`. Requires both arguments to hold a tree.
+ static bool is_either_profiled(const InlineData& data1,
+ const InlineData& data2) {
+ assert(data1.is_tree() && data2.is_tree());
+ return (data1.as_tree_.cordz_info | data2.as_tree_.cordz_info) !=
+ kNullCordzInfo;
+ }
+
// Returns the cordz_info sampling instance for this instance, or nullptr
// if the current instance is not sampled and does not have CordzInfo data.
// Requires the current instance to hold a tree value.