diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c
index b8f5796e3ce6a6dd6669cd3e8267db1a95bd6bbd..291d8f3ab4a9b2fc1db93f5ba31561953fac7c60 100644
--- a/libavcodec/ac3dec.c
+++ b/libavcodec/ac3dec.c
@@ -392,7 +392,7 @@ static int decode_exponents(GetBitContext *gbc, int exp_strategy, int ngrps,
     prevexp = absexp;
     for(i=0,j=0; i<ngrps*3; i++) {
         prevexp += dexp[i] - 2;
-        if (prevexp < 0 || prevexp > 24)
+        if (prevexp > 24U)
             return -1;
         switch (group_size) {
             case 4: dexps[j++] = prevexp;