[Ffmpeg-cvslog] r5597 - trunk/libavutil/intfloat_readwrite.c

michael subversion
Mon Jul 3 14:09:11 CEST 2006


Author: michael
Date: Mon Jul  3 14:09:10 2006
New Revision: 5597

Modified:
   trunk/libavutil/intfloat_readwrite.c

Log:
simplify


Modified: trunk/libavutil/intfloat_readwrite.c
==============================================================================
--- trunk/libavutil/intfloat_readwrite.c	(original)
+++ trunk/libavutil/intfloat_readwrite.c	Mon Jul  3 14:09:10 2006
@@ -43,7 +43,7 @@
     int e, i;
 
     for (i = 0; i < 8; i++)
-        m |= (uint64_t)ext.mantissa[i]<<(56-(i<<3));
+        m = (m<<8) + ext.mantissa[i];
     e = (((int)ext.exponent[0]&0x7f)<<8) | ext.exponent[1];
     if (e == 0x7fff && m)
         return 0.0/0.0;
@@ -51,7 +51,7 @@
                              * mantissa bit is written as opposed to the
                              * single and double precision formats */
     if (ext.exponent[0]&0x80)
-        return ldexp(-m, e);
+        m= -m;
     return ldexp(m, e);
 }
 
@@ -72,7 +72,7 @@
 }
 
 AVExtFloat av_dbl2ext(double d){
-    struct AVExtFloat ext;
+    struct AVExtFloat ext= {{0}};
     int e, i; double f; uint64_t m;
 
     f = fabs(frexp(d, &e));
@@ -83,11 +83,8 @@
         m = (uint64_t)ldexp(f, 64);
         for (i=0; i < 8; i++)
             ext.mantissa[i] = m>>(56-(i<<3));
-    } else if (f == 0.0) {
-        memset (&ext, 0, 10);
-    } else {
+    } else if (f != 0.0) {
         ext.exponent[0] = 0x7f; ext.exponent[1] = 0xff;
-        memset (&ext.mantissa, 0, 8);
         if (f != 1/0.0)
             ext.mantissa[0] = ~0;
     }




More information about the ffmpeg-cvslog mailing list