From 37a34a1a7e3b9cf3b60cb4fb42bbf2ca3e798b0a Mon Sep 17 00:00:00 2001 From: Nikolai Tillmann Date: Fri, 13 Oct 2023 16:42:08 -0700 Subject: [PATCH] prefer calling empty() instead of size() Summary: This may be faster. And as a bonus, the statement now fits on a single line. Reviewed By: thezhangwei Differential Revision: D50279900 fbshipit-source-id: 8864f20c8923b5fec763bc651ceca037ad282591 --- include/sparta/AbstractEnvironment.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/sparta/AbstractEnvironment.h b/include/sparta/AbstractEnvironment.h index 06c670e..3acc884 100644 --- a/include/sparta/AbstractEnvironment.h +++ b/include/sparta/AbstractEnvironment.h @@ -266,8 +266,7 @@ class MapValue final : public AbstractValue> { AbstractValueKind kind() const { // If the map is empty, then all variables are implicitly bound to Top, // i.e., the abstract environment itself is Top. - return (m_map.size() == 0) ? AbstractValueKind::Top - : AbstractValueKind::Value; + return m_map.empty() ? AbstractValueKind::Top : AbstractValueKind::Value; } bool leq(const MapValue& other) const { return m_map.leq(other.m_map); }