summaryrefslogtreecommitdiff
path: root/simpleperf/build_id.h
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2021-10-07 16:59:05 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2021-10-07 16:59:05 +0000
commit23c944f6dd01b7975a0dd85d48ab4f2abbad2593 (patch)
treedd72a84514306c5cc0c9025a1fb9e9e3976ced32 /simpleperf/build_id.h
parente474f50680b5c938d7462172b949578699df2854 (diff)
parent3b739c8720db08d5b34e8a547a5b2f6305fe37b6 (diff)
downloadextras-23c944f6dd01b7975a0dd85d48ab4f2abbad2593.tar.gz
Snap for 7803083 from 3b739c8720db08d5b34e8a547a5b2f6305fe37b6 to mainline-tzdata2-release
Change-Id: I3f7a03441a6392968c6e25d20d018e592a2c1e93
Diffstat (limited to 'simpleperf/build_id.h')
-rw-r--r--simpleperf/build_id.h27
1 files changed, 14 insertions, 13 deletions
diff --git a/simpleperf/build_id.h b/simpleperf/build_id.h
index 9f360bdb..05acc266 100644
--- a/simpleperf/build_id.h
+++ b/simpleperf/build_id.h
@@ -17,9 +17,11 @@
#ifndef SIMPLE_PERF_BUILD_ID_H_
#define SIMPLE_PERF_BUILD_ID_H_
+#include <android-base/stringprintf.h>
#include <string.h>
#include <algorithm>
-#include <android-base/stringprintf.h>
+
+namespace simpleperf {
constexpr size_t BUILD_ID_SIZE = 20;
@@ -29,13 +31,9 @@ constexpr size_t BUILD_ID_SIZE = 20;
// memory.
class BuildId {
public:
- static size_t Size() {
- return BUILD_ID_SIZE;
- }
+ static size_t Size() { return BUILD_ID_SIZE; }
- BuildId() {
- memset(data_, '\0', BUILD_ID_SIZE);
- }
+ BuildId() { memset(data_, '\0', BUILD_ID_SIZE); }
// Copy build id from a byte array, like {0x76, 0x00, 0x32,...}.
BuildId(const void* data, size_t len) : BuildId() {
@@ -60,9 +58,7 @@ class BuildId {
}
}
- const unsigned char* Data() const {
- return data_;
- }
+ const unsigned char* Data() const { return data_; }
std::string ToString() const {
std::string s = "0x";
@@ -76,9 +72,7 @@ class BuildId {
return memcmp(data_, build_id.data_, BUILD_ID_SIZE) == 0;
}
- bool operator!=(const BuildId& build_id) const {
- return !(*this == build_id);
- }
+ bool operator!=(const BuildId& build_id) const { return !(*this == build_id); }
bool IsEmpty() const {
static BuildId empty_build_id;
@@ -89,4 +83,11 @@ class BuildId {
unsigned char data_[BUILD_ID_SIZE];
};
+inline std::ostream& operator<<(std::ostream& os, const BuildId& build_id) {
+ os << build_id.ToString();
+ return os;
+}
+
+} // namespace simpleperf
+
#endif // SIMPLE_PERF_BUILD_ID_H_