summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathis Rosenhauer <rosenhauer@dkrz.de>2014-10-24 16:55:18 +0200
committerMathis Rosenhauer <rosenhauer@dkrz.de>2014-10-24 16:55:18 +0200
commit38f62c33502362059079349df3ed90c4915c530f (patch)
treecd2fde0fb4ed927aba39d7f35f76620fc9e35128
parentb519321aa915b8023a6cc3479ace64613faf0810 (diff)
downloadlibaec-38f62c33502362059079349df3ed90c4915c530f.tar.gz
libaec-38f62c33502362059079349df3ed90c4915c530f.tar.bz2
libaec-38f62c33502362059079349df3ed90c4915c530f.zip
xmin/xmax all 32 bits.
-rw-r--r--src/decode.c6
-rw-r--r--src/decode.h4
-rw-r--r--src/encode.c4
3 files changed, 7 insertions, 7 deletions
diff --git a/src/decode.c b/src/decode.c
index f3b94e8..d89eb2d 100644
--- a/src/decode.c
+++ b/src/decode.c
@@ -715,11 +715,11 @@ int aec_decode_init(struct aec_stream *strm)
}
if (strm->flags & AEC_DATA_SIGNED) {
- state->xmin = -(INT64_C(1) << (strm->bits_per_sample - 1));
- state->xmax = (UINT64_C(1) << (strm->bits_per_sample - 1)) - 1;
+ state->xmax = UINT32_MAX >> (32 - strm->bits_per_sample + 1);
+ state->xmin = ~state->xmax;
} else {
state->xmin = 0;
- state->xmax = (UINT64_C(1) << strm->bits_per_sample) - 1;
+ state->xmax = UINT32_MAX >> (32 - strm->bits_per_sample);
}
state->in_blklen = (strm->block_size * strm->bits_per_sample
diff --git a/src/decode.h b/src/decode.h
index 57a2ec8..6dee669 100644
--- a/src/decode.h
+++ b/src/decode.h
@@ -81,10 +81,10 @@ struct internal_state {
int32_t last_out;
/* minimum integer for post-processing */
- int64_t xmin;
+ uint32_t xmin;
/* maximum integer for post-processing */
- int64_t xmax;
+ uint32_t xmax;
/* length of uncompressed input block should be the longest
possible block */
diff --git a/src/encode.c b/src/encode.c
index dd72239..1c36008 100644
--- a/src/encode.c
+++ b/src/encode.c
@@ -851,12 +851,12 @@ int aec_encode_init(struct aec_stream *strm)
state->rsi_len = strm->rsi * strm->block_size * state->bytes_per_sample;
if (strm->flags & AEC_DATA_SIGNED) {
- state->xmax = (UINT64_C(1) << (strm->bits_per_sample - 1)) - 1;
+ state->xmax = UINT32_MAX >> (32 - strm->bits_per_sample + 1);
state->xmin = ~state->xmax;
state->preprocess = preprocess_signed;
} else {
state->xmin = 0;
- state->xmax = (UINT64_C(1) << strm->bits_per_sample) - 1;
+ state->xmax = UINT32_MAX >> (32 - strm->bits_per_sample);
state->preprocess = preprocess_unsigned;
}