path: root/src/widgets/styles/qstyle.cpp
diff options
authorThiago Macieira <>2018-12-14 12:34:55 -0800
committerThiago Macieira <>2018-12-21 17:48:56 +0000
commita7cea16005ea657d5de82d99a1f716a267eaf9bb (patch)
tree952856a24a51c592380e533fdbf84944c0b94950 /src/widgets/styles/qstyle.cpp
parent9ab04795e2eb8ae3fdb6ab6ef75f26db9d25e876 (diff)
MSVC x86: implement add_overflow for quint64
There's no 64-bit ADD instruction, so we make do with ADD+ADC. This is what Clang generates. ICC uses the two as well, but then performs some subtractions to find out if it overflowed. GCC for some inexplicable reason attempts to use SSE2 if that's enabled, otherwise it performs the subtractions like ICC. Alternative implementation which generates better code, but violates strict aliasing: uint *low = reinterpret_cast<uint *>(r); uint *high = low + 1; return _addcarry_u32(_addcarry_u32(0, unsigned(v1), unsigned(v2), low), v1 >> 32, v2 >> 32, high); Manual testing shows this works. tst_qnumeric passes in debug mode. MSVC 2017 15.9 still miscompiles in release mode (reported to MS as [1]). [1] Change-Id: I61ce366d57bc46c89db5fffd15704d53ebd4af3c Reviewed-by: Thomas Miller <> Reviewed-by: Allan Sandfeld Jensen <>
Diffstat (limited to 'src/widgets/styles/qstyle.cpp')
0 files changed, 0 insertions, 0 deletions