From 94078f864577d9bd08cb17eb4b695e5d03ac1b3e Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 21 Jan 2015 23:29:52 +0100 Subject: QDateTimePrivate: remove pointless comparisons For any 1-bit flag: bool(var & flag) <=> (var & flag) == flag but gcc didn't seem to get it: (Surprising) effects on Linux GCC 4.9 stripped release builds: text -4936B (!!) data +-0B relocs +-0 It seems this enables some dead code detection, but I must confess I don't quite understand how such a small change can have such a dramatic effect on the executable size, even after diffing the assembler output. Change-Id: Ia307fde0de16160ea51bbb3ed6c1ff203d4f9091 Reviewed-by: Thiago Macieira --- src/corelib/tools/qdatetime_p.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/corelib/tools/qdatetime_p.h') diff --git a/src/corelib/tools/qdatetime_p.h b/src/corelib/tools/qdatetime_p.h index 99d69a575d..78e9d6cabd 100644 --- a/src/corelib/tools/qdatetime_p.h +++ b/src/corelib/tools/qdatetime_p.h @@ -126,14 +126,14 @@ public: void refreshDateTime(); // Get/set date and time status - inline bool isNullDate() const { return (m_status & NullDate) == NullDate; } - inline bool isNullTime() const { return (m_status & NullTime) == NullTime; } - inline bool isValidDate() const { return (m_status & ValidDate) == ValidDate; } - inline bool isValidTime() const { return (m_status & ValidTime) == ValidTime; } - inline bool isValidDateTime() const { return (m_status & ValidDateTime) == ValidDateTime; } + inline bool isNullDate() const { return m_status & NullDate; } + inline bool isNullTime() const { return m_status & NullTime; } + inline bool isValidDate() const { return m_status & ValidDate; } + inline bool isValidTime() const { return m_status & ValidTime; } + inline bool isValidDateTime() const { return m_status & ValidDateTime; } inline void setValidDateTime() { m_status = m_status | ValidDateTime; } inline void clearValidDateTime() { m_status = m_status & ~ValidDateTime; } - inline bool isTimeZoneCached() const { return (m_status & TimeZoneCached) == TimeZoneCached; } + inline bool isTimeZoneCached() const { return m_status & TimeZoneCached; } inline void setTimeZoneCached() { m_status = m_status | TimeZoneCached; } inline void clearTimeZoneCached() { m_status = m_status & ~TimeZoneCached; } inline void clearSetToDaylightStatus() { m_status = m_status & ~SetToStandardTime & ~SetToDaylightTime; } -- cgit v1.2.3