diff options
author | Kelvin Zhang <zhangkelvin@google.com> | 2021-09-23 21:22:44 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2021-09-23 21:22:44 +0000 |
commit | 46d9915e16c0dff671b79de3482579c950cbad70 (patch) | |
tree | 0b28a8eea68a4f16a03561e7237b976e5489c548 | |
parent | 6ef5bb4230cb0d41e83a7475126004fa31b926e7 (diff) | |
parent | aa2a1cdcc50dbd10890ebb5632d8b7f427ca99f4 (diff) | |
download | puffin-46d9915e16c0dff671b79de3482579c950cbad70.tar.gz |
Add comparison operator for bitextent am: 44c83ceeac am: 2ab145decd am: 45d87eb8a0 am: aa2a1cdcc5
Original change: https://android-review.googlesource.com/c/platform/external/puffin/+/1835273
Change-Id: Ifc2aa24a35d20e6f97ff989353cab40e7d3d0363
-rw-r--r-- | src/include/puffin/common.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/include/puffin/common.h b/src/include/puffin/common.h index 954b7d9..07b8589 100644 --- a/src/include/puffin/common.h +++ b/src/include/puffin/common.h @@ -43,12 +43,18 @@ struct ByteExtent { }; struct BitExtent { - BitExtent(uint64_t offset, uint64_t length) + constexpr BitExtent(uint64_t offset, uint64_t length) : offset(offset), length(length) {} - bool operator==(const BitExtent& other) const { + constexpr bool operator==(const BitExtent& other) const { return this->length == other.length && this->offset == other.offset; } + constexpr bool operator<(const BitExtent& other) const { + if (offset != other.offset) { + return offset < other.offset; + } + return length < other.length; + } uint64_t offset; uint64_t length; |