shithub: opus

Download patch

ref: 5685bd31a66966976e81c0d1a930bc5f1ed609be
parent: de74fc1b6b46b4d3a11af2efabfb54f813042664
author: Gregory Maxwell <[email protected]>
date: Mon Aug 20 06:45:53 EDT 2012

Replace long long in celt/ with opus_int64.

--- a/celt/_kiss_fft_guts.h
+++ b/celt/_kiss_fft_guts.h
@@ -48,7 +48,6 @@
 #include "arch.h"
 
 
-# define SAMPPROD long long
 #define SAMP_MAX 2147483647
 #define TWID_MAX 32767
 #define TRIG_UPSCALE 1
--- a/celt/fixed_debug.h
+++ b/celt/fixed_debug.h
@@ -36,9 +36,9 @@
 
 #ifdef CELT_C
 #include "opus_defines.h"
-OPUS_EXPORT long long celt_mips=0;
+OPUS_EXPORT opus_int64 celt_mips=0;
 #else
-extern long long celt_mips;
+extern opus_int64 celt_mips;
 #endif
 
 #define MULT16_16SU(a,b) ((opus_val32)(opus_val16)(a)*(opus_val32)(opus_uint16)(b))
@@ -80,9 +80,9 @@
    celt_mips++;
    return res;
 }
-static inline int NEG32(long long x)
+static inline int NEG32(opus_int64 x)
 {
-   long long res;
+   opus_int64 res;
    if (!VERIFY_INT(x))
    {
       fprintf (stderr, "NEG16: input is not int: %d\n", (int)x);
@@ -179,9 +179,9 @@
    return res;
 }
 
-static inline int SHR32(long long a, int shift)
+static inline int SHR32(opus_int64 a, int shift)
 {
-   long long  res;
+   opus_int64  res;
    if (!VERIFY_INT(a) || !VERIFY_SHORT(shift))
    {
       fprintf (stderr, "SHR32: inputs are not int: %d %d\n", (int)a, shift);
@@ -201,9 +201,9 @@
    return res;
 }
 #define SHL32(a, shift) SHL32_(a, shift, __FILE__, __LINE__)
-static inline int SHL32_(long long a, int shift, char *file, int line)
+static inline int SHL32_(opus_int64 a, int shift, char *file, int line)
 {
-   long long  res;
+   opus_int64  res;
    if (!VERIFY_INT(a) || !VERIFY_SHORT(shift))
    {
       fprintf (stderr, "SHL32: inputs are not int: %lld %d in %s: line %d\n", a, shift, file, line);
@@ -280,9 +280,9 @@
 }
 
 #define ADD32(a, b) ADD32_(a, b, __FILE__, __LINE__)
-static inline int ADD32_(long long a, long long b, char *file, int line)
+static inline int ADD32_(opus_int64 a, opus_int64 b, char *file, int line)
 {
-   long long res;
+   opus_int64 res;
    if (!VERIFY_INT(a) || !VERIFY_INT(b))
    {
       fprintf (stderr, "ADD32: inputs are not int: %d %d in %s: line %d\n", (int)a, (int)b, file, line);
@@ -303,9 +303,9 @@
 }
 
 #define SUB32(a, b) SUB32_(a, b, __FILE__, __LINE__)
-static inline int SUB32_(long long a, long long b, char *file, int line)
+static inline int SUB32_(opus_int64 a, opus_int64 b, char *file, int line)
 {
-   long long res;
+   opus_int64 res;
    if (!VERIFY_INT(a) || !VERIFY_INT(b))
    {
       fprintf (stderr, "SUB32: inputs are not int: %d %d in %s: line %d\n", (int)a, (int)b, file, line);
@@ -327,9 +327,9 @@
 
 #undef UADD32
 #define UADD32(a, b) UADD32_(a, b, __FILE__, __LINE__)
-static inline unsigned int UADD32_(unsigned long long a, unsigned long long b, char *file, int line)
+static inline unsigned int UADD32_(opus_uint64 a, opus_uint64 b, char *file, int line)
 {
-   unsigned long long res;
+   opus_uint64 res;
    if (!VERIFY_UINT(a) || !VERIFY_UINT(b))
    {
       fprintf (stderr, "UADD32: inputs are not uint32: %llu %llu in %s: line %d\n", a, b, file, line);
@@ -351,9 +351,9 @@
 
 #undef USUB32
 #define USUB32(a, b) USUB32_(a, b, __FILE__, __LINE__)
-static inline unsigned int USUB32_(unsigned long long a, unsigned long long b, char *file, int line)
+static inline unsigned int USUB32_(opus_uint64 a, opus_uint64 b, char *file, int line)
 {
-   unsigned long long res;
+   opus_uint64 res;
    if (!VERIFY_UINT(a) || !VERIFY_UINT(b))
    {
       fprintf (stderr, "USUB32: inputs are not uint32: %llu %llu in %s: line %d\n", a, b, file, line);
@@ -406,7 +406,7 @@
 #define MULT16_16(a, b) MULT16_16_(a, b, __FILE__, __LINE__)
 static inline int MULT16_16_(int a, int b, char *file, int line)
 {
-   long long res;
+   opus_int64 res;
    if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
    {
       fprintf (stderr, "MULT16_16: inputs are not short: %d %d in %s: line %d\n", a, b, file, line);
@@ -414,7 +414,7 @@
       celt_assert(0);
 #endif
    }
-   res = ((long long)a)*b;
+   res = ((opus_int64)a)*b;
    if (!VERIFY_INT(res))
    {
       fprintf (stderr, "MULT16_16: output is not int: %d in %s: line %d\n", (int)res, file, line);
@@ -429,9 +429,9 @@
 #define MAC16_16(c,a,b)     (celt_mips-=2,ADD32((c),MULT16_16((a),(b))))
 
 #define MULT16_32_QX(a, b, Q) MULT16_32_QX_(a, b, Q, __FILE__, __LINE__)
-static inline int MULT16_32_QX_(int a, long long b, int Q, char *file, int line)
+static inline int MULT16_32_QX_(int a, opus_int64 b, int Q, char *file, int line)
 {
-   long long res;
+   opus_int64 res;
    if (!VERIFY_SHORT(a) || !VERIFY_INT(b))
    {
       fprintf (stderr, "MULT16_32_Q%d: inputs are not short+int: %d %d in %s: line %d\n", Q, (int)a, (int)b, file, line);
@@ -446,7 +446,7 @@
       celt_assert(0);
 #endif
    }
-   res = (((long long)a)*(long long)b) >> Q;
+   res = (((opus_int64)a)*(opus_int64)b) >> Q;
    if (!VERIFY_INT(res))
    {
       fprintf (stderr, "MULT16_32_Q%d: output is not int: %d*%d=%d in %s: line %d\n", Q, (int)a, (int)b,(int)res, file, line);
@@ -464,7 +464,7 @@
 #define MULT16_32_PX(a, b, Q) MULT16_32_PX_(a, b, Q, __FILE__, __LINE__)
 static inline int MULT16_32_PX_(int a, opus_int64 b, int Q, char *file, int line)
 {
-   long long res;
+   opus_int64 res;
    if (!VERIFY_SHORT(a) || !VERIFY_INT(b))
    {
       fprintf (stderr, "MULT16_32_P%d: inputs are not short+int: %d %d in %s: line %d\n\n", Q, (int)a, (int)b, file, line);
@@ -509,7 +509,7 @@
 
 static inline int MULT16_16_Q11_32(int a, int b)
 {
-   long long res;
+   opus_int64 res;
    if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
    {
       fprintf (stderr, "MULT16_16_Q11: inputs are not short: %d %d\n", a, b);
@@ -517,7 +517,7 @@
       celt_assert(0);
 #endif
    }
-   res = ((long long)a)*b;
+   res = ((opus_int64)a)*b;
    res >>= 11;
    if (!VERIFY_INT(res))
    {
@@ -531,7 +531,7 @@
 }
 static inline short MULT16_16_Q13(int a, int b)
 {
-   long long res;
+   opus_int64 res;
    if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
    {
       fprintf (stderr, "MULT16_16_Q13: inputs are not short: %d %d\n", a, b);
@@ -539,7 +539,7 @@
       celt_assert(0);
 #endif
    }
-   res = ((long long)a)*b;
+   res = ((opus_int64)a)*b;
    res >>= 13;
    if (!VERIFY_SHORT(res))
    {
@@ -553,7 +553,7 @@
 }
 static inline short MULT16_16_Q14(int a, int b)
 {
-   long long res;
+   opus_int64 res;
    if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
    {
       fprintf (stderr, "MULT16_16_Q14: inputs are not short: %d %d\n", a, b);
@@ -561,7 +561,7 @@
       celt_assert(0);
 #endif
    }
-   res = ((long long)a)*b;
+   res = ((opus_int64)a)*b;
    res >>= 14;
    if (!VERIFY_SHORT(res))
    {
@@ -577,7 +577,7 @@
 #define MULT16_16_Q15(a, b) MULT16_16_Q15_(a, b, __FILE__, __LINE__)
 static inline short MULT16_16_Q15_(int a, int b, char *file, int line)
 {
-   long long res;
+   opus_int64 res;
    if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
    {
       fprintf (stderr, "MULT16_16_Q15: inputs are not short: %d %d in %s: line %d\n", a, b, file, line);
@@ -585,7 +585,7 @@
       celt_assert(0);
 #endif
    }
-   res = ((long long)a)*b;
+   res = ((opus_int64)a)*b;
    res >>= 15;
    if (!VERIFY_SHORT(res))
    {
@@ -600,7 +600,7 @@
 
 static inline short MULT16_16_P13(int a, int b)
 {
-   long long res;
+   opus_int64 res;
    if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
    {
       fprintf (stderr, "MULT16_16_P13: inputs are not short: %d %d\n", a, b);
@@ -608,7 +608,7 @@
       celt_assert(0);
 #endif
    }
-   res = ((long long)a)*b;
+   res = ((opus_int64)a)*b;
    res += 4096;
    if (!VERIFY_INT(res))
    {
@@ -630,7 +630,7 @@
 }
 static inline short MULT16_16_P14(int a, int b)
 {
-   long long res;
+   opus_int64 res;
    if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
    {
       fprintf (stderr, "MULT16_16_P14: inputs are not short: %d %d\n", a, b);
@@ -638,7 +638,7 @@
       celt_assert(0);
 #endif
    }
-   res = ((long long)a)*b;
+   res = ((opus_int64)a)*b;
    res += 8192;
    if (!VERIFY_INT(res))
    {
@@ -660,7 +660,7 @@
 }
 static inline short MULT16_16_P15(int a, int b)
 {
-   long long res;
+   opus_int64 res;
    if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
    {
       fprintf (stderr, "MULT16_16_P15: inputs are not short: %d %d\n", a, b);
@@ -668,7 +668,7 @@
       celt_assert(0);
 #endif
    }
-   res = ((long long)a)*b;
+   res = ((opus_int64)a)*b;
    res += 16384;
    if (!VERIFY_INT(res))
    {
@@ -691,9 +691,9 @@
 
 #define DIV32_16(a, b) DIV32_16_(a, b, __FILE__, __LINE__)
 
-static inline int DIV32_16_(long long a, long long b, char *file, int line)
+static inline int DIV32_16_(opus_int64 a, opus_int64 b, char *file, int line)
 {
-   long long res;
+   opus_int64 res;
    if (b==0)
    {
       fprintf(stderr, "DIV32_16: divide by zero: %d/%d in %s: line %d\n", (int)a, (int)b, file, line);
@@ -726,9 +726,9 @@
 }
 
 #define DIV32(a, b) DIV32_(a, b, __FILE__, __LINE__)
-static inline int DIV32_(long long a, long long b, char *file, int line)
+static inline int DIV32_(opus_int64 a, opus_int64 b, char *file, int line)
 {
-   long long res;
+   opus_int64 res;
    if (b==0)
    {
       fprintf(stderr, "DIV32: divide by zero: %d/%d in %s: line %d\n", (int)a, (int)b, file, line);