summaryrefslogtreecommitdiff
path: root/xdelta3/xdelta3.c
diff options
context:
space:
mode:
authorjosh.macdonald <jmacd@users.noreply.github.com>2012-06-16 14:31:55 +0000
committerjosh.macdonald <jmacd@users.noreply.github.com>2012-06-16 14:31:55 +0000
commitc53d22c90235600c9518eccc63d2dd1416320044 (patch)
tree7de631d70b5669d9441241d9dc9089b08f3072b1 /xdelta3/xdelta3.c
parent54ac3c4c0c03d7dd52db661a94ec3ecccff826b4 (diff)
Updates for iOS build, Automake setup
Diffstat (limited to 'xdelta3/xdelta3.c')
-rw-r--r--xdelta3/xdelta3.c39
1 files changed, 2 insertions, 37 deletions
diff --git a/xdelta3/xdelta3.c b/xdelta3/xdelta3.c
index 1bc7fe5..0242c57 100644
--- a/xdelta3/xdelta3.c
+++ b/xdelta3/xdelta3.c
@@ -348,11 +348,6 @@ typedef enum {
348} xd3_section_type; 348} xd3_section_type;
349 349
350typedef unsigned int xd3_rtype; 350typedef unsigned int xd3_rtype;
351#define XD3_NOOP 0U
352#define XD3_ADD 1U
353#define XD3_RUN 2U
354#define XD3_CPY 3U /* XD3_CPY rtypes are represented as (XD3_CPY +
355 * copy-mode value) */
356 351
357/***********************************************************************/ 352/***********************************************************************/
358 353
@@ -425,8 +420,6 @@ XD3_MAKELIST(xd3_rlist, xd3_rinst, link);
425#define INST_HEAD(s) ((s)->enc_heads[2]) 420#define INST_HEAD(s) ((s)->enc_heads[2])
426#define ADDR_HEAD(s) ((s)->enc_heads[3]) 421#define ADDR_HEAD(s) ((s)->enc_heads[3])
427 422
428#define SIZEOF_ARRAY(x) (sizeof(x) / sizeof(x[0]))
429
430#define TOTAL_MODES(x) (2+(x)->acache.s_same+(x)->acache.s_near) 423#define TOTAL_MODES(x) (2+(x)->acache.s_same+(x)->acache.s_near)
431 424
432/* Template instances. */ 425/* Template instances. */
@@ -474,21 +467,6 @@ XD3_MAKELIST(xd3_rlist, xd3_rinst, link);
474 else { run_c = (c); run_l = 1; } } while (0) 467 else { run_c = (c); run_l = 1; } } while (0)
475 468
476/* This CPP-conditional stuff can be cleaned up... */ 469/* This CPP-conditional stuff can be cleaned up... */
477#if XD3_DEBUG
478#define IF_DEBUG(x) x
479#else
480#define IF_DEBUG(x)
481#endif
482#if XD3_DEBUG > 1
483#define IF_DEBUG1(x) x
484#else
485#define IF_DEBUG1(x)
486#endif
487#if XD3_DEBUG > 2
488#define IF_DEBUG2(x) x
489#else
490#define IF_DEBUG2(x)
491#endif
492#if REGRESSION_TEST 470#if REGRESSION_TEST
493#define IF_REGRESSION(x) x 471#define IF_REGRESSION(x) x
494#else 472#else
@@ -1541,7 +1519,8 @@ xd3_round_blksize (usize_t sz, usize_t blksz)
1541#define A32_DO8(buf,i) A32_DO4(buf,i); A32_DO4(buf,i+4); 1519#define A32_DO8(buf,i) A32_DO4(buf,i); A32_DO4(buf,i+4);
1542#define A32_DO16(buf) A32_DO8(buf,0); A32_DO8(buf,8); 1520#define A32_DO16(buf) A32_DO8(buf,0); A32_DO8(buf,8);
1543 1521
1544static unsigned long adler32 (unsigned long adler, const uint8_t *buf, usize_t len) 1522static unsigned long adler32 (unsigned long adler, const uint8_t *buf,
1523 usize_t len)
1545{ 1524{
1546 unsigned long s1 = adler & 0xffff; 1525 unsigned long s1 = adler & 0xffff;
1547 unsigned long s2 = (adler >> 16) & 0xffff; 1526 unsigned long s2 = (adler >> 16) & 0xffff;
@@ -4502,7 +4481,6 @@ xd3_source_match_setup (xd3_stream *stream, xoff_t srcpos)
4502 return 1; 4481 return 1;
4503} 4482}
4504 4483
4505#if 1
4506static inline int 4484static inline int
4507xd3_forward_match(const uint8_t *s1c, const uint8_t *s2c, int n) 4485xd3_forward_match(const uint8_t *s1c, const uint8_t *s2c, int n)
4508{ 4486{
@@ -4537,19 +4515,6 @@ xd3_forward_match(const uint8_t *s1c, const uint8_t *s2c, int n)
4537 } 4515 }
4538 return i; 4516 return i;
4539} 4517}
4540#else
4541static inline usize_t
4542xd3_forward_match(const uint8_t *s1c,
4543 const uint8_t *s2c,
4544 usize_t n) {
4545 usize_t i = 0;
4546 while (i < n && s1c[i] == s2c[i])
4547 {
4548 i++;
4549 }
4550 return i;
4551}
4552#endif
4553 4518
4554/* This function expands the source match backward and forward. It is 4519/* This function expands the source match backward and forward. It is
4555 * reentrant, since xd3_getblk may return XD3_GETSRCBLK, so most 4520 * reentrant, since xd3_getblk may return XD3_GETSRCBLK, so most