From 60c316b4197609b75b85e5ae7225972e1df6f431 Mon Sep 17 00:00:00 2001
From: Gregory Maxwell <greg@xiph.org>
Date: Thu, 4 Nov 2010 20:14:19 -0400
Subject: [PATCH] Eliminate some promotions to double. A fair number of
 implicit promotions remain but they all involve math functions which exist
 only as double precision form in C89.

---
 libcelt/celt.c | 10 +++++-----
 libcelt/plc.c  |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/libcelt/celt.c b/libcelt/celt.c
index 621141ea9..e34a45fe9 100644
--- a/libcelt/celt.c
+++ b/libcelt/celt.c
@@ -212,7 +212,7 @@ static int transient_analysis(const celt_word32 * restrict in, int len, int C,
       mem1 = x - SHR32(y,1);
 #else
       mem0 = mem1 + y - 2*x;
-      mem1 = x - .5*y;
+      mem1 = x - .5f*y;
 #endif
       tmp[i] = EXTRACT16(SHR(y,2));
    }
@@ -617,13 +617,13 @@ static int alloc_trim_analysis(const CELTMode *m, const celt_norm *X,
       }
       sum = MULT16_16_Q15(QCONST16(1.f/8, 15), sum);
       /*printf ("%f\n", sum);*/
-      if (sum > QCONST16(.995,10))
+      if (sum > QCONST16(.995f,10))
          trim_index-=3;
-      else if (sum > QCONST16(.92,10))
+      else if (sum > QCONST16(.92f,10))
          trim_index-=2;
-      else if (sum > QCONST16(.8,10))
+      else if (sum > QCONST16(.8f,10))
          trim_index-=1;
-      else if (sum < QCONST16(.4,10))
+      else if (sum < QCONST16(.4f,10))
          trim_index+=1;
    }
 #if 0
diff --git a/libcelt/plc.c b/libcelt/plc.c
index 5625c679a..cadad2b92 100644
--- a/libcelt/plc.c
+++ b/libcelt/plc.c
@@ -83,7 +83,7 @@ int          p
          if (error<SHR32(ac[0],10))
             break;
 #else
-         if (error<.001*ac[0])
+         if (error<.001f*ac[0])
             break;
 #endif
       }
-- 
GitLab