MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / av_dbl2ext

Function av_dbl2ext

libavutil/intfloat_readwrite.c:77–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75}
76
77AVExtFloat av_dbl2ext(double d){
78 struct AVExtFloat ext= {{0}};
79 int e, i; double f; uint64_t m;
80
81 f = fabs(frexp(d, &e));
82 if (f >= 0.5 && f < 1) {
83 e += 16382;
84 ext.exponent[0] = e>>8;
85 ext.exponent[1] = e;
86 m = (uint64_t)ldexp(f, 64);
87 for (i=0; i < 8; i++)
88 ext.mantissa[i] = m>>(56-(i<<3));
89 } else if (f != 0.0) {
90 ext.exponent[0] = 0x7f; ext.exponent[1] = 0xff;
91 if (f != 1/0.0)
92 ext.mantissa[0] = ~0;
93 }
94 if (d < 0)
95 ext.exponent[0] |= 0x80;
96 return ext;
97}
98

Callers 1

aiff_write_headerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected