From 0a93eb7b7d1c8117fb1ec165d09d8d0ad21d08ed Mon Sep 17 00:00:00 2001 From: Josh MacDonald Date: Thu, 1 Oct 2015 23:11:04 -0700 Subject: LARGEWINDOW->LARGESIZET, now passing regtests and selftests --- xdelta3/xdelta3-main.h | 2 +- xdelta3/xdelta3-test.h | 10 +++++----- xdelta3/xdelta3.c | 16 +++++++++------- 3 files changed, 15 insertions(+), 13 deletions(-) (limited to 'xdelta3') diff --git a/xdelta3/xdelta3-main.h b/xdelta3/xdelta3-main.h index 1a536eb..c3cc4aa 100644 --- a/xdelta3/xdelta3-main.h +++ b/xdelta3/xdelta3-main.h @@ -374,7 +374,7 @@ main_config (void) XPR(NTR "XD3_STDIO=%d\n", XD3_STDIO); XPR(NTR "XD3_WIN32=%d\n", XD3_WIN32); XPR(NTR "XD3_USE_LARGEFILE64=%d\n", XD3_USE_LARGEFILE64); - XPR(NTR "XD3_USE_LARGEWINDOW64=%d\n", XD3_USE_LARGEWINDOW64); + XPR(NTR "XD3_USE_LARGESIZET=%d\n", XD3_USE_LARGESIZET); XPR(NTR "XD3_DEFAULT_LEVEL=%d\n", XD3_DEFAULT_LEVEL); XPR(NTR "XD3_DEFAULT_IOPT_SIZE=%d\n", XD3_DEFAULT_IOPT_SIZE); XPR(NTR "XD3_DEFAULT_SPREVSZ=%d\n", XD3_DEFAULT_SPREVSZ); diff --git a/xdelta3/xdelta3-test.h b/xdelta3/xdelta3-test.h index c56c8cf..d7cb48e 100644 --- a/xdelta3/xdelta3-test.h +++ b/xdelta3/xdelta3-test.h @@ -2811,10 +2811,10 @@ test_iopt_flush_instructions (xd3_stream *stream, int ignore) /* * This tests the 32/64bit ambiguity for source-window matching. */ -#if !XD3_USE_LARGEWINDOW64 +#if !XD3_USE_LARGESIZET static int test_source_cksum_offset (xd3_stream *stream, int ignore) -{ + { xd3_source source; // Inputs are: @@ -2848,7 +2848,7 @@ test_source_cksum_offset (xd3_stream *stream, int ignore) stream->src = &source; for (test_ptr = cksum_test; test_ptr->cpos; test_ptr++) { - xoff_t r; + xoff_t r; stream->srcwin_cksum_pos = test_ptr->cpos; stream->total_in = test_ptr->ipos; @@ -2857,7 +2857,7 @@ test_source_cksum_offset (xd3_stream *stream, int ignore) } return 0; } -#endif /* !XD3_USE_LARGEWINDOW64 */ +#endif /* !XD3_USE_LARGESIZET */ static int test_in_memory (xd3_stream *stream, int ignore) @@ -2938,7 +2938,7 @@ int xd3_selftest (void) DO_TEST (in_memory, 0, 0); DO_TEST (iopt_flush_instructions, 0, 0); -#if !XD3_USE_LARGEWINDOW64 +#if !XD3_USE_LARGESIZET DO_TEST (source_cksum_offset, 0, 0); #endif diff --git a/xdelta3/xdelta3.c b/xdelta3/xdelta3.c index 266574f..874b35a 100644 --- a/xdelta3/xdelta3.c +++ b/xdelta3/xdelta3.c @@ -2965,7 +2965,7 @@ xd3_encode_init (xd3_stream *stream, int full_init) * identical or short inputs require no table allocation. */ if (large_comp) { - /* TODO(jmacd) Need to check for overflow here. */ + /* TODO Need to check for overflow here. */ usize_t hash_values = stream->src->max_winsize / stream->smatcher.large_step; @@ -3590,7 +3590,7 @@ xd3_string_match_init (xd3_stream *stream) return 0; } -#if XD3_USE_LARGEFILE64 +#if XD3_USE_LARGEFILE64 && !XD3_USE_LARGESIZET /* This function handles the 32/64bit ambiguity -- file positions are 64bit * but the hash table for source-offsets is 32bit. */ static xoff_t @@ -3670,11 +3670,11 @@ xd3_srcwin_setup (xd3_stream *stream) /* Otherwise, we have to make a guess. More copies may still be * issued, but we have to decide the source window base and length - * now. */ + * now. + * TODO: This >> 2 is arbitrary--try other values. */ src->srcbase = stream->match_minaddr; - /* TODO(jmacd) Need to check for overflow here. */ src->srclen = xd3_max ((usize_t) length, - stream->avail_in + (stream->avail_in >> 2)); + stream->avail_in + (stream->avail_in >> 2)); if (src->eof_known) { @@ -3745,11 +3745,12 @@ xd3_source_match_setup (xd3_stream *stream, xoff_t srcpos) /* Going backwards, the 1.5-pass algorithm allows some * already-matched input may be covered by a longer source match. - * The greedy algorithm does not allow this. */ + * The greedy algorithm does not allow this. + * TODO: Measure this. */ if (stream->flags & XD3_BEGREEDY) { /* The greedy algorithm allows backward matching to the last - matched position. */ + * matched position. */ greedy_or_not = xd3_iopt_last_matched (stream); } else @@ -3778,6 +3779,7 @@ xd3_source_match_setup (xd3_stream *stream, xoff_t srcpos) * 0--src->size. We compare the usize_t * match_maxfwd/match_maxback against the xoff_t * src->size/srcpos values and take the min. */ + /* TODO #if XD3_USE_LARGESIZET ? */ if (srcpos < stream->match_maxback) { stream->match_maxback = (usize_t) srcpos; -- cgit v1.2.3