Skip to content

Commit 6ee4a16

Browse files
committed
reduce nesting of operator
Easier to read Signed-off-by: Rosen Penev <[email protected]>
1 parent f7de846 commit 6ee4a16

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

src/asfvideo.cpp

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -78,20 +78,13 @@ std::string AsfVideo::GUIDTag::to_string() {
7878
}
7979

8080
bool AsfVideo::GUIDTag::operator<(const GUIDTag& other) const {
81-
if (data1_ < other.data1_)
82-
return true;
83-
if (data1_ == other.data1_) {
84-
if (data2_ < other.data2_)
85-
return true;
86-
if (data2_ == other.data2_) {
87-
if (data3_ < other.data3_)
88-
return true;
89-
if (data3_ == other.data3_) {
90-
return std::lexicographical_compare(data4_.begin(), data4_.end(), other.data4_.begin(), other.data4_.end());
91-
}
92-
}
93-
}
94-
return false;
81+
if (data1_ != other.data1_)
82+
return data1_ < other.data1_;
83+
if (data2_ != other.data2_)
84+
return data2_ < other.data2_;
85+
if (data3_ != other.data3_)
86+
return data3_ < other.data3_;
87+
return std::lexicographical_compare(data4_.begin(), data4_.end(), other.data4_.begin(), other.data4_.end());
9588
}
9689

9790
const AsfVideo::GUIDTag Header(0x75B22630, 0x668E, 0x11CF, {0xA6, 0xD9, 0x00, 0xAA, 0x00, 0x62, 0xCE, 0x6C});

0 commit comments

Comments
 (0)