summaryrefslogtreecommitdiff
path: root/libavutil/intfloat_readwrite.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2006-07-03 12:09:10 +0000
committerMichael Niedermayer <michaelni@gmx.at>2006-07-03 12:09:10 +0000
commit767aeb11fb9895d40659284e0834b177768a8a07 (patch)
tree66c35b08f9cd82a0bef3aef657f6990f4e47569a /libavutil/intfloat_readwrite.c
parent5351c29cbe15c25d0a81a896ed56e6f5495746a7 (diff)
simplify
Originally committed as revision 5597 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavutil/intfloat_readwrite.c')
-rw-r--r--libavutil/intfloat_readwrite.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/libavutil/intfloat_readwrite.c b/libavutil/intfloat_readwrite.c
index 6450de1024..b429fe98ea 100644
--- a/libavutil/intfloat_readwrite.c
+++ b/libavutil/intfloat_readwrite.c
@@ -43,7 +43,7 @@ double av_ext2dbl(const AVExtFloat ext){
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 @@ double av_ext2dbl(const AVExtFloat ext){
* 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 @@ int32_t av_flt2int(float d){
}
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 @@ AVExtFloat av_dbl2ext(double d){
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;
}