summaryrefslogtreecommitdiff
path: root/xdelta3/xdelta3.h
diff options
context:
space:
mode:
Diffstat (limited to 'xdelta3/xdelta3.h')
-rw-r--r--xdelta3/xdelta3.h35
1 files changed, 8 insertions, 27 deletions
diff --git a/xdelta3/xdelta3.h b/xdelta3/xdelta3.h
index 39e0c17..b31cbe9 100644
--- a/xdelta3/xdelta3.h
+++ b/xdelta3/xdelta3.h
@@ -293,30 +293,12 @@ typedef int (xd3_comp_table_func) (xd3_stream *stream,
293#define XD3_ASSERT(x) (void)0 293#define XD3_ASSERT(x) (void)0
294#endif /* XD3_DEBUG */ 294#endif /* XD3_DEBUG */
295 295
296#ifdef __GNUC__
297#ifndef max
298#define max(x,y) ({ \
299 const typeof(x) _x = (x); \
300 const typeof(y) _y = (y); \
301 (void) (&_x == &_y); \
302 _x > _y ? _x : _y; })
303#endif /* __GNUC__ */
304
305#ifndef min
306#define min(x,y) ({ \
307 const typeof(x) _x = (x); \
308 const typeof(y) _y = (y); \
309 (void) (&_x == &_y); \
310 _x < _y ? _x : _y; })
311#endif
312#else /* __GNUC__ */
313#ifndef max 296#ifndef max
314#define max(x,y) ((x) < (y) ? (y) : (x)) 297#define max(x,y) ((x) < (y) ? (y) : (x))
315#endif 298#endif
316#ifndef min 299#ifndef min
317#define min(x,y) ((x) < (y) ? (x) : (y)) 300#define min(x,y) ((x) < (y) ? (x) : (y))
318#endif 301#endif
319#endif /* __GNUC__ */
320 302
321/**************************************************************** 303/****************************************************************
322 PUBLIC ENUMS 304 PUBLIC ENUMS
@@ -351,7 +333,7 @@ typedef enum {
351 XD3_INVALID_INPUT = -17712, /* invalid input/decoder error */ 333 XD3_INVALID_INPUT = -17712, /* invalid input/decoder error */
352 XD3_NOSECOND = -17713, /* when secondary compression finds no 334 XD3_NOSECOND = -17713, /* when secondary compression finds no
353 improvement. */ 335 improvement. */
354 XD3_UNIMPLEMENTED = -17714, /* currently VCD_TARGET */ 336 XD3_UNIMPLEMENTED = -17714 /* currently VCD_TARGET */
355} xd3_rvalues; 337} xd3_rvalues;
356 338
357/* special values in config->flags */ 339/* special values in config->flags */
@@ -408,7 +390,7 @@ typedef enum
408 XD3_COMPLEVEL_2 = (2 << XD3_COMPLEVEL_SHIFT), 390 XD3_COMPLEVEL_2 = (2 << XD3_COMPLEVEL_SHIFT),
409 XD3_COMPLEVEL_3 = (3 << XD3_COMPLEVEL_SHIFT), 391 XD3_COMPLEVEL_3 = (3 << XD3_COMPLEVEL_SHIFT),
410 XD3_COMPLEVEL_6 = (6 << XD3_COMPLEVEL_SHIFT), 392 XD3_COMPLEVEL_6 = (6 << XD3_COMPLEVEL_SHIFT),
411 XD3_COMPLEVEL_9 = (9 << XD3_COMPLEVEL_SHIFT), 393 XD3_COMPLEVEL_9 = (9 << XD3_COMPLEVEL_SHIFT)
412 394
413} xd3_flags; 395} xd3_flags;
414 396
@@ -423,7 +405,7 @@ typedef enum
423 XD3_SMATCH_FAST = 2, 405 XD3_SMATCH_FAST = 2,
424 XD3_SMATCH_FASTER = 3, 406 XD3_SMATCH_FASTER = 3,
425 XD3_SMATCH_FASTEST = 4, 407 XD3_SMATCH_FASTEST = 4,
426 XD3_SMATCH_SOFT = 5, 408 XD3_SMATCH_SOFT = 5
427} xd3_smatch_cfg; 409} xd3_smatch_cfg;
428 410
429/********************************************************************* 411/*********************************************************************
@@ -448,7 +430,7 @@ typedef enum {
448 source/target. */ 430 source/target. */
449 MATCH_FORWARD = 2, /* currently expanding a match forward in the 431 MATCH_FORWARD = 2, /* currently expanding a match forward in the
450 source/target. */ 432 source/target. */
451 MATCH_SEARCHING = 3, /* currently searching for a match. */ 433 MATCH_SEARCHING = 3 /* currently searching for a match. */
452 434
453} xd3_match_state; 435} xd3_match_state;
454 436
@@ -467,7 +449,7 @@ typedef enum {
467 ENC_FLUSH = 4, /* currently emitting output. */ 449 ENC_FLUSH = 4, /* currently emitting output. */
468 ENC_POSTOUT = 5, /* after an output section. */ 450 ENC_POSTOUT = 5, /* after an output section. */
469 ENC_POSTWIN = 6, /* after all output sections. */ 451 ENC_POSTWIN = 6, /* after all output sections. */
470 ENC_ABORTED = 7, /* abort. */ 452 ENC_ABORTED = 7 /* abort. */
471} xd3_encode_state; 453} xd3_encode_state;
472 454
473/* The xd3_decode_input state machine steps through these states in 455/* The xd3_decode_input state machine steps through these states in
@@ -520,7 +502,7 @@ typedef enum {
520 502
521 DEC_FINISH = 23, /* window finished */ 503 DEC_FINISH = 23, /* window finished */
522 504
523 DEC_ABORTED = 24, /* xd3_abort_stream */ 505 DEC_ABORTED = 24 /* xd3_abort_stream */
524} xd3_decode_state; 506} xd3_decode_state;
525 507
526/************************************************************ 508/************************************************************
@@ -841,8 +823,7 @@ struct _xd3_stream
841 * if there is at least one 823 * if there is at least one
842 * match in the buffer. */ 824 * match in the buffer. */
843 825
844 // SRCWIN 826 /* SRCWIN: these variables plus srcwin_maxsz above (set by config) */
845 // these variables plus srcwin_maxsz above (set by config)
846 int srcwin_decided; /* boolean: true if srclen and 827 int srcwin_decided; /* boolean: true if srclen and
847 srcbase have been 828 srcbase have been
848 decided. */ 829 decided. */
@@ -851,7 +832,7 @@ struct _xd3_stream
851 decided early. */ 832 decided early. */
852 xoff_t srcwin_cksum_pos; /* Source checksum position */ 833 xoff_t srcwin_cksum_pos; /* Source checksum position */
853 834
854 // MATCH 835 /* MATCH */
855 xd3_match_state match_state; /* encoder match state */ 836 xd3_match_state match_state; /* encoder match state */
856 xoff_t match_srcpos; /* current match source 837 xoff_t match_srcpos; /* current match source
857 position relative to 838 position relative to