From 11ca2a7f22fd2e2d50c20057affb5fbea343eab1 Mon Sep 17 00:00:00 2001 From: Mathis Rosenhauer Date: Mon, 15 Aug 2016 11:41:29 +0200 Subject: Add macro for used RSI --- src/decode.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/decode.c b/src/decode.c index aa75f04..4efbee3 100644 --- a/src/decode.c +++ b/src/decode.c @@ -60,7 +60,7 @@ #endif #define ROS 5 - +#define RSI_USED(state) ((size_t)(state->rsip - state->rsi_buffer)) #define BUFFERSPACE(strm) (strm->avail_in >= strm->state->in_blklen \ && strm->avail_out >= strm->state->out_blklen) @@ -203,7 +203,7 @@ static inline void check_rsi_end(struct aec_stream *strm) */ struct internal_state *state = strm->state; - if (state->rsi_size == (size_t)(state->rsip - state->rsi_buffer)) { + if (state->rsi_size == RSI_USED(state)) { state->flush_output(strm); state->flush_start = state->rsi_buffer; state->rsip = state->rsi_buffer; @@ -523,7 +523,7 @@ static int m_zero_block(struct aec_stream *strm) fs_drop(strm); if (zero_blocks == ROS) { - b = (int)(state->rsip - state->rsi_buffer) / strm->block_size; + b = (int)RSI_USED(state) / strm->block_size; zero_blocks = MIN(strm->rsi - b, 64 - (b % 64)); } else if (zero_blocks > ROS) { zero_blocks--; @@ -537,7 +537,7 @@ static int m_zero_block(struct aec_stream *strm) zero_bytes = i * state->bytes_per_sample; if (strm->avail_out >= zero_bytes) { - if (state->rsi_size - (state->rsip - state->rsi_buffer) < i) + if (state->rsi_size - RSI_USED(state) < i) return M_ERROR; memset(state->rsip, 0, i * sizeof(uint32_t)); -- cgit v1.2.3