diff options
author | Josh MacDonald <josh.macdonald@gmail.com> | 2015-10-01 23:11:04 -0700 |
---|---|---|
committer | Josh MacDonald <josh.macdonald@gmail.com> | 2015-10-01 23:11:04 -0700 |
commit | 0a93eb7b7d1c8117fb1ec165d09d8d0ad21d08ed (patch) | |
tree | 3a768b2b5c266c027d541c41501618a644fb25b2 /xdelta3 | |
parent | db89f26dec16ef999a782a1f90ec2e58e674e2b1 (diff) |
LARGEWINDOW->LARGESIZET, now passing regtests and selftests
Diffstat (limited to 'xdelta3')
-rw-r--r-- | xdelta3/xdelta3-main.h | 2 | ||||
-rw-r--r-- | xdelta3/xdelta3-test.h | 10 | ||||
-rw-r--r-- | xdelta3/xdelta3.c | 16 |
3 files changed, 15 insertions, 13 deletions
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) | |||
374 | XPR(NTR "XD3_STDIO=%d\n", XD3_STDIO); | 374 | XPR(NTR "XD3_STDIO=%d\n", XD3_STDIO); |
375 | XPR(NTR "XD3_WIN32=%d\n", XD3_WIN32); | 375 | XPR(NTR "XD3_WIN32=%d\n", XD3_WIN32); |
376 | XPR(NTR "XD3_USE_LARGEFILE64=%d\n", XD3_USE_LARGEFILE64); | 376 | XPR(NTR "XD3_USE_LARGEFILE64=%d\n", XD3_USE_LARGEFILE64); |
377 | XPR(NTR "XD3_USE_LARGEWINDOW64=%d\n", XD3_USE_LARGEWINDOW64); | 377 | XPR(NTR "XD3_USE_LARGESIZET=%d\n", XD3_USE_LARGESIZET); |
378 | XPR(NTR "XD3_DEFAULT_LEVEL=%d\n", XD3_DEFAULT_LEVEL); | 378 | XPR(NTR "XD3_DEFAULT_LEVEL=%d\n", XD3_DEFAULT_LEVEL); |
379 | XPR(NTR "XD3_DEFAULT_IOPT_SIZE=%d\n", XD3_DEFAULT_IOPT_SIZE); | 379 | XPR(NTR "XD3_DEFAULT_IOPT_SIZE=%d\n", XD3_DEFAULT_IOPT_SIZE); |
380 | XPR(NTR "XD3_DEFAULT_SPREVSZ=%d\n", XD3_DEFAULT_SPREVSZ); | 380 | 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) | |||
2811 | /* | 2811 | /* |
2812 | * This tests the 32/64bit ambiguity for source-window matching. | 2812 | * This tests the 32/64bit ambiguity for source-window matching. |
2813 | */ | 2813 | */ |
2814 | #if !XD3_USE_LARGEWINDOW64 | 2814 | #if !XD3_USE_LARGESIZET |
2815 | static int | 2815 | static int |
2816 | test_source_cksum_offset (xd3_stream *stream, int ignore) | 2816 | test_source_cksum_offset (xd3_stream *stream, int ignore) |
2817 | { | 2817 | { |
2818 | xd3_source source; | 2818 | xd3_source source; |
2819 | 2819 | ||
2820 | // Inputs are: | 2820 | // Inputs are: |
@@ -2848,7 +2848,7 @@ test_source_cksum_offset (xd3_stream *stream, int ignore) | |||
2848 | stream->src = &source; | 2848 | stream->src = &source; |
2849 | 2849 | ||
2850 | for (test_ptr = cksum_test; test_ptr->cpos; test_ptr++) { | 2850 | for (test_ptr = cksum_test; test_ptr->cpos; test_ptr++) { |
2851 | xoff_t r; | 2851 | xoff_t r; |
2852 | stream->srcwin_cksum_pos = test_ptr->cpos; | 2852 | stream->srcwin_cksum_pos = test_ptr->cpos; |
2853 | stream->total_in = test_ptr->ipos; | 2853 | stream->total_in = test_ptr->ipos; |
2854 | 2854 | ||
@@ -2857,7 +2857,7 @@ test_source_cksum_offset (xd3_stream *stream, int ignore) | |||
2857 | } | 2857 | } |
2858 | return 0; | 2858 | return 0; |
2859 | } | 2859 | } |
2860 | #endif /* !XD3_USE_LARGEWINDOW64 */ | 2860 | #endif /* !XD3_USE_LARGESIZET */ |
2861 | 2861 | ||
2862 | static int | 2862 | static int |
2863 | test_in_memory (xd3_stream *stream, int ignore) | 2863 | test_in_memory (xd3_stream *stream, int ignore) |
@@ -2938,7 +2938,7 @@ int xd3_selftest (void) | |||
2938 | DO_TEST (in_memory, 0, 0); | 2938 | DO_TEST (in_memory, 0, 0); |
2939 | 2939 | ||
2940 | DO_TEST (iopt_flush_instructions, 0, 0); | 2940 | DO_TEST (iopt_flush_instructions, 0, 0); |
2941 | #if !XD3_USE_LARGEWINDOW64 | 2941 | #if !XD3_USE_LARGESIZET |
2942 | DO_TEST (source_cksum_offset, 0, 0); | 2942 | DO_TEST (source_cksum_offset, 0, 0); |
2943 | #endif | 2943 | #endif |
2944 | 2944 | ||
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) | |||
2965 | * identical or short inputs require no table allocation. */ | 2965 | * identical or short inputs require no table allocation. */ |
2966 | if (large_comp) | 2966 | if (large_comp) |
2967 | { | 2967 | { |
2968 | /* TODO(jmacd) Need to check for overflow here. */ | 2968 | /* TODO Need to check for overflow here. */ |
2969 | usize_t hash_values = stream->src->max_winsize / | 2969 | usize_t hash_values = stream->src->max_winsize / |
2970 | stream->smatcher.large_step; | 2970 | stream->smatcher.large_step; |
2971 | 2971 | ||
@@ -3590,7 +3590,7 @@ xd3_string_match_init (xd3_stream *stream) | |||
3590 | return 0; | 3590 | return 0; |
3591 | } | 3591 | } |
3592 | 3592 | ||
3593 | #if XD3_USE_LARGEFILE64 | 3593 | #if XD3_USE_LARGEFILE64 && !XD3_USE_LARGESIZET |
3594 | /* This function handles the 32/64bit ambiguity -- file positions are 64bit | 3594 | /* This function handles the 32/64bit ambiguity -- file positions are 64bit |
3595 | * but the hash table for source-offsets is 32bit. */ | 3595 | * but the hash table for source-offsets is 32bit. */ |
3596 | static xoff_t | 3596 | static xoff_t |
@@ -3670,11 +3670,11 @@ xd3_srcwin_setup (xd3_stream *stream) | |||
3670 | 3670 | ||
3671 | /* Otherwise, we have to make a guess. More copies may still be | 3671 | /* Otherwise, we have to make a guess. More copies may still be |
3672 | * issued, but we have to decide the source window base and length | 3672 | * issued, but we have to decide the source window base and length |
3673 | * now. */ | 3673 | * now. |
3674 | * TODO: This >> 2 is arbitrary--try other values. */ | ||
3674 | src->srcbase = stream->match_minaddr; | 3675 | src->srcbase = stream->match_minaddr; |
3675 | /* TODO(jmacd) Need to check for overflow here. */ | ||
3676 | src->srclen = xd3_max ((usize_t) length, | 3676 | src->srclen = xd3_max ((usize_t) length, |
3677 | stream->avail_in + (stream->avail_in >> 2)); | 3677 | stream->avail_in + (stream->avail_in >> 2)); |
3678 | 3678 | ||
3679 | if (src->eof_known) | 3679 | if (src->eof_known) |
3680 | { | 3680 | { |
@@ -3745,11 +3745,12 @@ xd3_source_match_setup (xd3_stream *stream, xoff_t srcpos) | |||
3745 | 3745 | ||
3746 | /* Going backwards, the 1.5-pass algorithm allows some | 3746 | /* Going backwards, the 1.5-pass algorithm allows some |
3747 | * already-matched input may be covered by a longer source match. | 3747 | * already-matched input may be covered by a longer source match. |
3748 | * The greedy algorithm does not allow this. */ | 3748 | * The greedy algorithm does not allow this. |
3749 | * TODO: Measure this. */ | ||
3749 | if (stream->flags & XD3_BEGREEDY) | 3750 | if (stream->flags & XD3_BEGREEDY) |
3750 | { | 3751 | { |
3751 | /* The greedy algorithm allows backward matching to the last | 3752 | /* The greedy algorithm allows backward matching to the last |
3752 | matched position. */ | 3753 | * matched position. */ |
3753 | greedy_or_not = xd3_iopt_last_matched (stream); | 3754 | greedy_or_not = xd3_iopt_last_matched (stream); |
3754 | } | 3755 | } |
3755 | else | 3756 | else |
@@ -3778,6 +3779,7 @@ xd3_source_match_setup (xd3_stream *stream, xoff_t srcpos) | |||
3778 | * 0--src->size. We compare the usize_t | 3779 | * 0--src->size. We compare the usize_t |
3779 | * match_maxfwd/match_maxback against the xoff_t | 3780 | * match_maxfwd/match_maxback against the xoff_t |
3780 | * src->size/srcpos values and take the min. */ | 3781 | * src->size/srcpos values and take the min. */ |
3782 | /* TODO #if XD3_USE_LARGESIZET ? */ | ||
3781 | if (srcpos < stream->match_maxback) | 3783 | if (srcpos < stream->match_maxback) |
3782 | { | 3784 | { |
3783 | stream->match_maxback = (usize_t) srcpos; | 3785 | stream->match_maxback = (usize_t) srcpos; |