diff options
author | Jędrzej Nowacki <jedrzej.nowacki@digia.com> | 2013-09-11 15:14:07 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-13 09:22:15 +0200 |
commit | 5fd344389e163f1833f3d58c3cc994ac74063440 (patch) | |
tree | 8ab2896efb1b69c0092089091b0d6e386b03d496 /src/plugins/platforms/eglfs | |
parent | a26f47756be60348ec1fff1402163356e9f6b059 (diff) |
Remove redundant checks in some tools classes
This is a simple optimisation allowed to us by the fact that all platforms
we run on use two's complement for the signed integers. The trick works as
long as one of the two signed integers is known beforehand to be
non-negative:
- by definition, for any signed integer i, i <= INT_MAX
- by definition, for any unsigned integer u, u >= 0
- given a signed integer x >= 0, 0U <= uint(x) <= uint(INT_MAX)
- therefore, given another signed integer y of whatever
value, uint(x) < uint(y) ←→ x < y && y >= 0
The trick is an optimisation because the compiler doesn't know that one of
the two sides is always non-negative. Otherwise, it would do the
same optimisation.
Change-Id: If256ec0df4e06335805af8010bb67ce5fd3e065a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/plugins/platforms/eglfs')
0 files changed, 0 insertions, 0 deletions