summaryrefslogtreecommitdiff
path: root/arith.h
diff options
context:
space:
mode:
Diffstat (limited to 'arith.h')
-rw-r--r--arith.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/arith.h b/arith.h
index 442f060..292c2d8 100644
--- a/arith.h
+++ b/arith.h
@@ -261,6 +261,12 @@ static inline short MAX16(const short *y, int len, int *pos)
#ifdef ZT_CHUNKSIZE
static inline void ACSS(short *dst, short *src)
{
+#ifdef BFIN
+ int x;
+/* Add src to dst with saturation, storing in dst */
+ for (x=0;x<ZT_CHUNKSIZE;x++)
+ dst[x] = __builtin_bfin_add_fr1x16(dst[x], src[x]);
+#else
int x,sum;
/* Add src to dst with saturation, storing in dst */
for (x=0;x<ZT_CHUNKSIZE;x++) {
@@ -271,10 +277,17 @@ static inline void ACSS(short *dst, short *src)
sum = -32768;
dst[x] = sum;
}
+#endif
}
static inline void SCSS(short *dst, short *src)
{
+#ifdef BFIN
+ int x;
+/* subtract src from dst with saturation, storing in dst */
+ for (x=0;x<ZT_CHUNKSIZE;x++)
+ dst[x] = __builtin_bfin_sub_fr1x16(dst[x], src[x]);
+#else
int x,sum;
/* Add src to dst with saturation, storing in dst */
for (x=0;x<ZT_CHUNKSIZE;x++) {
@@ -285,6 +298,7 @@ static inline void SCSS(short *dst, short *src)
sum = -32768;
dst[x] = sum;
}
+#endif
}
#endif /* ZT_CHUNKSIZE */