summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordbailey <dbailey@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2007-12-20 17:09:16 +0000
committerdbailey <dbailey@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2007-12-20 17:09:16 +0000
commita98e0b7a5e0b3d2522c90d798b4827948cbbf2f8 (patch)
tree4e15103de451b4be33ccd4df99e2e71cab45cea0
parent1cdd316d671dac981ace7ecae43a389a5883978f (diff)
Add blackfin enhancement. Closes issue #0011283
git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.4@3548 5390a7c7-147a-4af0-8ec9-7488f05a26cb
-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 */