From 00b6c314759222f7d5350c8568939938943b7da0 Mon Sep 17 00:00:00 2001 From: ZhouSiLe Date: Mon, 1 Jul 2024 13:35:38 +0800 Subject: [PATCH] refactor: CheckIntersection --- src/cluster/cluster_defs.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/cluster/cluster_defs.h b/src/cluster/cluster_defs.h index 4c098c90d7e..70545a90638 100644 --- a/src/cluster/cluster_defs.h +++ b/src/cluster/cluster_defs.h @@ -52,8 +52,7 @@ struct SlotRange { bool Contain(int slot) const { return IsValid() && slot >= start && slot <= end; } bool CheckIntersection(const SlotRange &rhs) const { - if (!IsValid() || !rhs.IsValid() || end < rhs.start || rhs.end < start) return false; - return true; + return IsValid() && rhs.IsValid() && !(end < rhs.start || rhs.end < start); } std::string String() const { if (!IsValid()) return "empty";