From b20512d2a44fa789eab7fafc60f4cad6cb22ed71 Mon Sep 17 00:00:00 2001
From: Moritz Hanke <hanke@dkrz.de>
Date: Mon, 10 Dec 2012 13:46:54 +0100
Subject: [PATCH] unrolling in fill_acc

---
 src/decode.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/src/decode.c b/src/decode.c
index 739c218..6787783 100644
--- a/src/decode.c
+++ b/src/decode.c
@@ -220,8 +220,25 @@ static inline void fill_acc(struct aec_stream *strm)
 
     strm->avail_in -= b;
     strm->state->bitp += b << 3;
-    while (b--)
+
+    switch (b) {
+
+      case (7):
+        strm->state->acc = (strm->state->acc << 8) | *strm->next_in++;
+      case (6):
+        strm->state->acc = (strm->state->acc << 8) | *strm->next_in++;
+      case (5):
+        strm->state->acc = (strm->state->acc << 8) | *strm->next_in++;
+      case (4):
         strm->state->acc = (strm->state->acc << 8) | *strm->next_in++;
+      case (3):
+        strm->state->acc = (strm->state->acc << 8) | *strm->next_in++;
+      case (2):
+        strm->state->acc = (strm->state->acc << 8) | *strm->next_in++;
+      case (1):
+        strm->state->acc = (strm->state->acc << 8) | *strm->next_in++;
+    };
+
 }
 
 static inline uint32_t direct_get(struct aec_stream *strm, unsigned int n)
-- 
GitLab