From f396c08f772a5ad4b364a9a2104b4af3678b7428 Mon Sep 17 00:00:00 2001
From: Jean-Marc Valin <jmvalin@jmvalin.ca>
Date: Wed, 18 Jun 2014 00:52:16 -0400
Subject: [PATCH] Adds SIG2WORD16() to fixed_debug.h

---
 celt/fixed_debug.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/celt/fixed_debug.h b/celt/fixed_debug.h
index 5d7120d4b..d28227f5d 100644
--- a/celt/fixed_debug.h
+++ b/celt/fixed_debug.h
@@ -768,6 +768,16 @@ static OPUS_INLINE int DIV32_(opus_int64 a, opus_int64 b, char *file, int line)
    return res;
 }
 
+static OPUS_INLINE opus_val16 SIG2WORD16_generic(celt_sig x)
+{
+   x = PSHR32(x, SIG_SHIFT);
+   x = MAX32(x, -32768);
+   x = MIN32(x, 32767);
+   return EXTRACT16(x);
+}
+#define SIG2WORD16(x) (SIG2WORD16_generic(x))
+
+
 #undef PRINT_MIPS
 #define PRINT_MIPS(file) do {fprintf (file, "total complexity = %llu MIPS\n", celt_mips);} while (0);
 
-- 
GitLab