diff --git a/libavcodec/bitstream.h b/libavcodec/bitstream.h
index 9d82e8b4160948a359dcb98019449946ec60499e..bbb7fcda09ce5c48923f10e127b1247282f12d0c 100644
--- a/libavcodec/bitstream.h
+++ b/libavcodec/bitstream.h
@@ -725,8 +725,13 @@ static inline void skip_bits1(GetBitContext *s){
 static inline unsigned int get_bits_long(GetBitContext *s, int n){
     if(n<=17) return get_bits(s, n);
     else{
+#ifdef ALT_BITSTREAM_READER_LE
+        int ret= get_bits(s, 16);
+        return ret | (get_bits(s, n-16) << 16);
+#else
         int ret= get_bits(s, 16) << (n-16);
         return ret | get_bits(s, n-16);
+#endif
     }
 }