diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2015-01-21 23:29:52 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2015-02-17 15:04:01 +0000 |
commit | 94078f864577d9bd08cb17eb4b695e5d03ac1b3e (patch) | |
tree | 0cebfe31f3c864d5e434aae618de962efa6a6670 | |
parent | df0d933db519620f02034ed0f1477b77dabdb8f4 (diff) |
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 <thiago.macieira@intel.com>
-rw-r--r-- | src/corelib/tools/qdatetime_p.h | 12 |
1 files changed, 6 insertions, 6 deletions
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; } |