diff --git a/libavcodec/ylc.c b/libavcodec/ylc.c
index ae46b3b8c2667bbde75b5b1d465996b898077175..11333222b9479e3d9cad22d58232486ee52f81af 100644
--- a/libavcodec/ylc.c
+++ b/libavcodec/ylc.c
@@ -69,7 +69,7 @@ static void get_tree_codes(uint32_t *bits, int16_t *lens, uint8_t *xlat,
 
     s = nodes[node].sym;
     if (s != -1) {
-        bits[*pos] = (~pfx) & ((1U << FFMAX(pl, 1)) - 1);
+        bits[*pos] = (~pfx) & ((1ULL << FFMAX(pl, 1)) - 1);
         lens[*pos] = FFMAX(pl, 1);
         xlat[*pos] = s + (pl == 0);
         (*pos)++;