diff options
author | Hans Kristian Rosbach <hk-git@circlestorm.org> | 2020-07-01 15:06:37 +0200 |
---|---|---|
committer | Hans Kristian Rosbach <hk-github@circlestorm.org> | 2020-07-03 15:33:43 +0200 |
commit | 47b1208c443e86928ad64175d0b2654c107c202c (patch) | |
tree | 7d29af4ed346a9e1852c0008b0781ed2c7a8a032 /deflate_fast.c | |
parent | 13cebfff9c6761dd8b9180aeea88fa566c978ba4 (diff) |
Add likely/unlikely hinting to all deflate algorithms.
Diffstat (limited to 'deflate_fast.c')
-rw-r--r-- | deflate_fast.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/deflate_fast.c b/deflate_fast.c index 7f73da3..f2a4a59 100644 --- a/deflate_fast.c +++ b/deflate_fast.c @@ -29,10 +29,10 @@ ZLIB_INTERNAL block_state deflate_fast(deflate_state *s, int flush) { */ if (s->lookahead < MIN_LOOKAHEAD) { fill_window(s); - if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) { + if (UNLIKELY(s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH)) { return need_more; } - if (s->lookahead == 0) + if (UNLIKELY(s->lookahead == 0)) break; /* flush the current block */ } @@ -88,15 +88,15 @@ ZLIB_INTERNAL block_state deflate_fast(deflate_state *s, int flush) { s->lookahead--; s->strstart++; } - if (bflush) + if (UNLIKELY(bflush)) FLUSH_BLOCK(s, 0); } s->insert = s->strstart < MIN_MATCH-1 ? s->strstart : MIN_MATCH-1; - if (flush == Z_FINISH) { + if (UNLIKELY(flush == Z_FINISH)) { FLUSH_BLOCK(s, 1); return finish_done; } - if (s->sym_next) + if (UNLIKELY(s->sym_next)) FLUSH_BLOCK(s, 0); return block_done; } |