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>
This commit is contained in:
Marc Mutz 2015-01-21 23:29:52 +01:00
parent df0d933db5
commit 94078f8645

View File

@ -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; }