Skip to content

Commit

Permalink
prefer calling empty() instead of size()
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Nikolai Tillmann authored and facebook-github-bot committed Oct 13, 2023
1 parent d525636 commit 37a34a1
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions include/sparta/AbstractEnvironment.h
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,7 @@ class MapValue final : public AbstractValue<MapValue<Map>> {
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); }
Expand Down

0 comments on commit 37a34a1

Please sign in to comment.