diff options
author | Stefan Beller <stefanbeller@googlemail.com> | 2013-08-16 23:22:37 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-08-18 12:56:23 -0700 |
commit | f7466e94375b3be27f229c78873f0acf8301c0a5 (patch) | |
tree | e89ea9893dc333d60231d0447b7b67973a3dff21 /imap-send.c | |
parent | edca4152560522a431a51fc0a06147fc680b5b18 (diff) | |
download | git-f7466e94375b3be27f229c78873f0acf8301c0a5.tar.gz |
create_delta_index: simplify condition always evaluating to truesb/diff-delta-remove-needless-comparison
The code sequence ' (1u << i) < hsize && i < 31 ' is a multi step
process, whose first step requires that 'i' is already less that 31,
otherwise the result (1u << i) is undefined (and 'undef_val < hsize'
can therefore be assumed to be 'false'), and so the later test i < 31
can always be optimized away as dead code ('i' is already less than 31,
or the short circuit 'and' applies).
So we need to get rid of that code. One way would be to exchange the
order of the conditions, so the expression 'i < 31 && (1u << i) < hsize'
would remove that optimized unstable code already.
However when checking the previous lines in that function, we can deduce
that 'hsize' must always be smaller than (1u<<31), since 506049c7df2c6
(fix >4GiB source delta assertion failure), because 'entries' is
capped at an upper bound of 0xfffffffeU, so 'hsize' contains a maximum
value of 0x3fffffff, which is smaller than (1u<<31), so the value of
'i' will never be larger than 31 and we can remove that condition
entirely.
Signed-off-by: Stefan Beller <stefanbeller@googlemail.com>
Acked-by: Nicolas Pitre <nico@fluxnic.net>
Acked-by: Philip Oakley <philipoakley@iee.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'imap-send.c')
0 files changed, 0 insertions, 0 deletions