diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2021-08-24 14:56:53 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2021-08-30 17:46:00 +0200 |
commit | 6db5fd5918e9c2fb73d61de13356307248c4f2e9 (patch) | |
tree | 4bbea647910160e50e10b2ba6e4ae20acbd3c6b8 /src/corelib/doc/snippets | |
parent | 0564e4afba41667e8e3610ee900562befa44731c (diff) |
Avoid UB (and the consequent need to suppress an MSVC warning)
Converting a negative signed value to its absolute value in the
matching unsigned type can be done by adding one, negating (which we
can now do without the UB), casting and then adding one again.
This is cleaner than casting the negative value to the unsigned type
in order to then "negate" it within that type, about which MSVC
grumbles; we can now avoid the need to suppress that grumble.
Change-Id: I9148ead23c928aeb2b90884a2f2e292fdf3af5e3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src/corelib/doc/snippets')
0 files changed, 0 insertions, 0 deletions