summaryrefslogtreecommitdiff
path: root/xdelta3/xdelta3.c
diff options
context:
space:
mode:
Diffstat (limited to 'xdelta3/xdelta3.c')
-rw-r--r--xdelta3/xdelta3.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/xdelta3/xdelta3.c b/xdelta3/xdelta3.c
index 1703f94..f58dc99 100644
--- a/xdelta3/xdelta3.c
+++ b/xdelta3/xdelta3.c
@@ -4561,19 +4561,20 @@ xd3_source_match_setup (xd3_stream *stream, xoff_t srcpos)
4561} 4561}
4562 4562
4563static inline xoff_t 4563static inline xoff_t
4564xd3_forward_match(const uint8_t *s1c, const uint8_t *s2c, xoff_t n) 4564xd3_forward_match(const uint8_t *s1c, const uint8_t *s2c, size_t n)
4565{ 4565{
4566 int i = 0; 4566 size_t i = 0;
4567#if UNALIGNED_OK 4567#if UNALIGNED_OK
4568 const int isize = sizeof(int); 4568 const size_t ssize = sizeof(size_t);
4569 int nint = (int) (n / isize); 4569 const size_t nint = n / ssize;
4570 4570
4571 /* If there are at least 8 elements */
4571 if (nint >> 3) 4572 if (nint >> 3)
4572 { 4573 {
4573 int j = 0; 4574 usize_t j = 0;
4574 const int *s1 = (const int*)s1c; 4575 const size_t *s1 = (const size_t*)s1c;
4575 const int *s2 = (const int*)s2c; 4576 const size_t *s2 = (const size_t*)s2c;
4576 int nint_8 = nint - 8; 4577 const size_t nint_8 = nint - 8;
4577 4578
4578 while (i <= nint_8 && 4579 while (i <= nint_8 &&
4579 s1[i++] == s2[j++] && 4580 s1[i++] == s2[j++] &&
@@ -4585,7 +4586,7 @@ xd3_forward_match(const uint8_t *s1c, const uint8_t *s2c, xoff_t n)
4585 s1[i++] == s2[j++] && 4586 s1[i++] == s2[j++] &&
4586 s1[i++] == s2[j++]) { } 4587 s1[i++] == s2[j++]) { }
4587 4588
4588 i = (i - 1) * isize; 4589 i = (i - 1) * ssize;
4589 } 4590 }
4590#endif 4591#endif
4591 4592