]> git.sesse.net Git - ffmpeg/blobdiff - libavutil/softfloat.h
Merge commit '5c018ee18895f88e9e1d2174059dcdd48bf872d2'
[ffmpeg] / libavutil / softfloat.h
index 392b6d814ccd7d5fc5e1eed3953c1e25a70b68b6..42723634891d3cccab79d5d76e008a0b35dbba31 100644 (file)
@@ -36,6 +36,12 @@ typedef struct SoftFloat{
     int32_t  exp;
 }SoftFloat;
 
+static inline av_const double av_sf2double(SoftFloat v) {
+    v.exp -= ONE_BITS +1;
+    if(v.exp > 0) return (double)v.mant * (double)(1 << v.exp);
+    else          return (double)v.mant / (double)(1 << (-v.exp));
+}
+
 static av_const SoftFloat av_normalize_sf(SoftFloat a){
     if(a.mant){
 #if 1
@@ -91,7 +97,7 @@ static inline av_const SoftFloat av_mul_sf(SoftFloat a, SoftFloat b){
  * b has to be normalized and not zero.
  * @return Will not be more denormalized than a.
  */
-static av_const SoftFloat av_div_sf(SoftFloat a, SoftFloat b){
+static inline av_const SoftFloat av_div_sf(SoftFloat a, SoftFloat b){
     a.exp -= b.exp;
     a.mant = ((int64_t)a.mant<<(ONE_BITS+1)) / b.mant;
     return av_normalize1_sf(a);