Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.5.1
-
None
-
837b5d458970f3981859cb9dfa0cec5fcd6d0c4f
Description
The definition of qRgba is:
inline Q_DECL_CONSTEXPR QRgb qRgba(int r, int g, int b, int a)// set RGBA value
{ return ((a & 0xff) << 24) | ((r & 0xff) << 16) | ((g & 0xff) << 8) | (b & 0xff); }Shifting the alpha value has undefined behavior, it needs to be converted to an unsigned int first.
This results in slow code with Visual C++, when VC++ is using SSE auto-vectorization.
(qRgb does the right thing, it's using an unsigned constant of 0xffu as alpha value.)
Attachments
For Gerrit Dashboard: QTBUG-49595 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
141790,2 | Fix undefined behavior in qRgba(). | 5.6 | qt/qtbase | Status: MERGED | +2 | 0 |