summaryrefslogtreecommitdiff
path: root/apps/codecs/libmusepack/mpcdec_math.h
diff options
context:
space:
mode:
Diffstat (limited to 'apps/codecs/libmusepack/mpcdec_math.h')
-rw-r--r--apps/codecs/libmusepack/mpcdec_math.h56
1 files changed, 28 insertions, 28 deletions
diff --git a/apps/codecs/libmusepack/mpcdec_math.h b/apps/codecs/libmusepack/mpcdec_math.h
index 55295dba32..bb79a52e6f 100644
--- a/apps/codecs/libmusepack/mpcdec_math.h
+++ b/apps/codecs/libmusepack/mpcdec_math.h
@@ -115,32 +115,32 @@
115 return t1; 115 return t1;
116 } 116 }
117 #elif defined(CPU_ARM) 117 #elif defined(CPU_ARM)
118 // borrowed and adapted from libMAD 118 /* Calculate: result = (X*Y)>>14 */
119 #define MPC_MULTIPLY(X,Y) \ 119 #define MPC_MULTIPLY(X,Y) \
120 ({ \ 120 ({ \
121 MPC_SAMPLE_FORMAT low; \ 121 MPC_SAMPLE_FORMAT lo; \
122 MPC_SAMPLE_FORMAT high; \ 122 MPC_SAMPLE_FORMAT hi; \
123 asm volatile ( /* will calculate: result = (X*Y)>>14 */ \ 123 asm volatile ( \
124 "smull %0,%1,%2,%3 \n\t" /* multiply with result %0 [0..31], %1 [32..63] */ \ 124 "smull %[lo], %[hi], %[x], %[y] \n\t" /* multiply */ \
125 "mov %0, %0, lsr #14 \n\t" /* %0 = %0 >> 14 */ \ 125 "mov %[lo], %[lo], lsr #14 \n\t" /* lo >>= 14 */ \
126 "orr %0, %0, %1, lsl #18 \n\t"/* result = %0 OR (%1 << 18) */ \ 126 "orr %[lo], %[lo], %[hi], lsl #18" /* lo |= (hi << 18) */ \
127 : "=&r"(low), "=&r" (high) \ 127 : [lo]"=&r"(lo), [hi]"=&r"(hi) \
128 : "r"(X),"r"(Y)); \ 128 : [x]"r"(X), [y]"r"(Y)); \
129 low; \ 129 lo; \
130 }) 130 })
131 131
132 // borrowed and adapted from libMAD 132 /* Calculate: result = (X*Y)>>Z */
133 #define MPC_MULTIPLY_EX(X,Y,Z) \ 133 #define MPC_MULTIPLY_EX(X,Y,Z) \
134 ({ \ 134 ({ \
135 MPC_SAMPLE_FORMAT low; \ 135 MPC_SAMPLE_FORMAT lo; \
136 MPC_SAMPLE_FORMAT high; \ 136 MPC_SAMPLE_FORMAT hi; \
137 asm volatile ( /* will calculate: result = (X*Y)>>Z */ \ 137 asm volatile ( \
138 "smull %0,%1,%2,%3 \n\t" /* multiply with result %0 [0..31], %1 [32..63] */ \ 138 "smull %[lo], %[hi], %[x], %[y] \n\t" /* multiply */ \
139 "mov %0, %0, lsr %4 \n\t" /* %0 = %0 >> Z */ \ 139 "mov %[lo], %[lo], lsr %[shr] \n\t" /* lo >>= Z */ \
140 "orr %0, %0, %1, lsl %5 \n\t" /* result = %0 OR (%1 << (32-Z)) */ \ 140 "orr %[lo], %[lo], %[hi], lsl %[shl]" /* lo |= (hi << (32-Z)) */ \
141 : "=&r"(low), "=&r" (high) \ 141 : [lo]"=&r"(lo), [hi]"=&r"(hi) \
142 : "r"(X),"r"(Y),"r"(Z),"r"(32-Z)); \ 142 : [x]"r"(X), [y]"r"(Y), [shr]"r"(Z), [shl]"r"(32-Z)); \
143 low; \ 143 lo; \
144 }) 144 })
145 #else /* libmusepack standard */ 145 #else /* libmusepack standard */
146 146
@@ -188,16 +188,16 @@
188 t; \ 188 t; \
189 }) 189 })
190 #elif defined(CPU_ARM) 190 #elif defined(CPU_ARM)
191 // borrowed and adapted from libMAD 191 /* Calculate: result = (X*Y)>>32, without need for >>32 */
192 #define MPC_MULTIPLY_FRACT(X,Y) \ 192 #define MPC_MULTIPLY_FRACT(X,Y) \
193 ({ \ 193 ({ \
194 MPC_SAMPLE_FORMAT low; \ 194 MPC_SAMPLE_FORMAT lo; \
195 MPC_SAMPLE_FORMAT high; \ 195 MPC_SAMPLE_FORMAT hi; \
196 asm volatile ( /* will calculate: result = (X*Y)>>32 */ \ 196 asm volatile ( \
197 "smull %0,%1,%2,%3 \n\t" /* multiply with result %0 [0..31], %1 [32..63] */ \ 197 "smull %[lo], %[hi], %[x], %[y]" /* hi = result */ \
198 : "=&r"(low), "=&r" (high) /* result = %1 [32..63], saves the >>32 */ \ 198 : [lo]"=&r"(lo), [hi]"=&r"(hi) \
199 : "r"(X),"r"(Y)); \ 199 : [x]"r"(X), [y]"r"(Y)); \
200 high; \ 200 hi; \
201 }) 201 })
202 #else 202 #else
203 #define MPC_MULTIPLY_FRACT(X,Y) MPC_MULTIPLY_EX(X,Y,32) 203 #define MPC_MULTIPLY_FRACT(X,Y) MPC_MULTIPLY_EX(X,Y,32)