summaryrefslogtreecommitdiff
path: root/xdelta3
diff options
context:
space:
mode:
Diffstat (limited to 'xdelta3')
-rw-r--r--xdelta3/xdelta3.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/xdelta3/xdelta3.c b/xdelta3/xdelta3.c
index 7476b3a..7de4a6f 100644
--- a/xdelta3/xdelta3.c
+++ b/xdelta3/xdelta3.c
@@ -3852,7 +3852,7 @@ xd3_source_match_setup (xd3_stream *stream, xoff_t srcpos)
3852 stream->match_maxfwd = srcavail; 3852 stream->match_maxfwd = srcavail;
3853 } 3853 }
3854 3854
3855 IF_DEBUG1(DP(RINT 3855 IF_DEBUG2(DP(RINT
3856 "[match_setup] srcpos %"Q"u (tgtpos %"Q"u) " 3856 "[match_setup] srcpos %"Q"u (tgtpos %"Q"u) "
3857 "restricted maxback %u maxfwd %u\n", 3857 "restricted maxback %u maxfwd %u\n",
3858 srcpos, 3858 srcpos,
@@ -4387,11 +4387,8 @@ xd3_srcwin_move_point (xd3_stream *stream, usize_t *next_move_point)
4387 * results in better compression for very-similar inputs, but worse 4387 * results in better compression for very-similar inputs, but worse
4388 * compression where data is deleted near the beginning of the file. 4388 * compression where data is deleted near the beginning of the file.
4389 * 4389 *
4390 * The new policy is slower and may benefit, or slightly worsen, 4390 * The new policy is simpler, somewhat slower and can benefit, or
4391 * compression performance. As shown by go/src/regtest.go (see the 4391 * slightly worsen, compression performance. */
4392 * 64bithash branch), this policy does worsen compression, somewhat
4393 * more significantly than hoped for. TODO revert.
4394 */
4395 if (absolute_input_pos < stream->src->max_winsize / 2) 4392 if (absolute_input_pos < stream->src->max_winsize / 2)
4396 { 4393 {
4397 target_cksum_pos = stream->src->max_winsize; 4394 target_cksum_pos = stream->src->max_winsize;
@@ -4401,10 +4398,6 @@ xd3_srcwin_move_point (xd3_stream *stream, usize_t *next_move_point)
4401 target_cksum_pos = absolute_input_pos + stream->src->max_winsize / 2; 4398 target_cksum_pos = absolute_input_pos + stream->src->max_winsize / 2;
4402 target_cksum_pos &= ~stream->src->maskby; 4399 target_cksum_pos &= ~stream->src->maskby;
4403 } 4400 }
4404
4405 /* If srcwin_cksum_pos is already greater, wait until the difference
4406 * is met. */
4407 XD3_ASSERT (stream->srcwin_cksum_pos <= target_cksum_pos);
4408 4401
4409 /* A long match may have extended past srcwin_cksum_pos. Don't 4402 /* A long match may have extended past srcwin_cksum_pos. Don't
4410 * start checksumming already-matched source data. */ 4403 * start checksumming already-matched source data. */
@@ -4513,8 +4506,9 @@ xd3_srcwin_move_point (xd3_stream *stream, usize_t *next_move_point)
4513 /* How long until this function should be called again. */ 4506 /* How long until this function should be called again. */
4514 XD3_ASSERT(stream->srcwin_cksum_pos >= target_cksum_pos); 4507 XD3_ASSERT(stream->srcwin_cksum_pos >= target_cksum_pos);
4515 4508
4516 *next_move_point = stream->input_position + stream->src->blksize / 2 - 4509 *next_move_point = stream->input_position +
4517 (stream->input_position & stream->src->maskby); 4510 stream->src->blksize -
4511 ((stream->srcwin_cksum_pos - target_cksum_pos) & stream->src->maskby);
4518 4512
4519 IF_DEBUG2 (DP(RINT 4513 IF_DEBUG2 (DP(RINT
4520 "[srcwin_move_point] finished T=%"Q"u " 4514 "[srcwin_move_point] finished T=%"Q"u "