Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-02-04 01:18:05 +0400
committerMichael Niedermayer <michaelni@gmx.at>2012-02-04 08:39:01 +0400
commit7f8027b76f1bdce7452d02513fc179cca20d8867 (patch)
treed3ed490c48fd0762f09b670689ac06c6c619cb82 /libavutil/adler32.c
parent25f35df11583800ee296effd42c51c65e9f3ef72 (diff)
adler32: avoid "too big" check in the inner loop
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil/adler32.c')
-rw-r--r--libavutil/adler32.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/libavutil/adler32.c b/libavutil/adler32.c
index f4f56ea9b6..571242e1cb 100644
--- a/libavutil/adler32.c
+++ b/libavutil/adler32.c
@@ -23,6 +23,7 @@
#include "config.h"
#include "adler32.h"
+#include "common.h"
#define BASE 65521L /* largest prime smaller than 65536 */
@@ -37,17 +38,22 @@ unsigned long av_adler32_update(unsigned long adler, const uint8_t * buf,
unsigned long s2 = adler >> 16;
while (len > 0) {
+ unsigned len2 = FFMIN((len-1) & ~15, 2048);
+ if (len2) {
+ len -= len2;
+
#if CONFIG_SMALL
- while (len > 4 && s2 < (1U << 31)) {
+ while (len2 >= 4) {
DO4(buf);
- len -= 4;
+ len2 -= 4;
}
#else
- while (len > 16 && s2 < (1U << 31)) {
+ while (len2 >= 16) {
DO16(buf);
- len -= 16;
+ len2 -= 16;
}
#endif
+ }
DO1(buf); len--;
s1 %= BASE;
s2 %= BASE;