simplification proposed by Rich
authorAurelien Jacobs <aurel@gnuage.org>
Sat, 1 Mar 2008 00:26:19 +0000 (00:26 +0000)
committerAurelien Jacobs <aurel@gnuage.org>
Sat, 1 Mar 2008 00:26:19 +0000 (00:26 +0000)
Originally committed as revision 12280 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavformat/matroskaenc.c

index 00818b5..d096f72 100644 (file)
@@ -149,7 +149,8 @@ static void put_ebml_num(ByteIOContext *pb, uint64_t num, int bytes)
 static void put_ebml_uint(ByteIOContext *pb, unsigned int elementid, uint64_t val)
 {
     int i, bytes = 1;
-    while (bytes < 8 && val >> bytes*8) bytes++;
+    uint64_t tmp = val;
+    while (tmp>>=8) bytes++;
 
     put_ebml_id(pb, elementid);
     put_ebml_num(pb, bytes, 0);