diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2001-04-24 02:02:21 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2001-04-24 02:02:21 +0000 |
commit | a87669fead1172ebff3c68b4f436e3e829efdcdd (patch) | |
tree | ab0754a7aeb97b46d7fb9eabb78f87805b980b19 /codecs/gsm/inc | |
parent | 1f9a30535942c9b35212651b7346f33824eaf55c (diff) |
Version 0.1.8 from FTP
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@295 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'codecs/gsm/inc')
-rwxr-xr-x | codecs/gsm/inc/private.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/codecs/gsm/inc/private.h b/codecs/gsm/inc/private.h index 6b538cc27..140aef1ae 100755 --- a/codecs/gsm/inc/private.h +++ b/codecs/gsm/inc/private.h @@ -98,6 +98,44 @@ extern word gsm_asr P((word a, int n)); # define GSM_L_MULT(a, b) /* word a, word b */ \ (((longword)(a) * (longword)(b)) << 1) +#if defined(__GNUC__) && defined(__i386__) + +static __inline__ int GSM_L_ADD(int a, int b) +{ + __asm__ __volatile__( + + "addl %2,%0; jno 0f; movl $0x7fffffff,%0; adcl $0,%0; 0:" + : "=r" (a) + : "0" (a), "ir" (b) + : "cc" + ); + return(a); +} + +static __inline__ short GSM_ADD(short a, short b) +{ + __asm__ __volatile__( + "addw %2,%0; jno 0f; movw $0x7fff,%0; adcw $0,%0; 0:" + : "=r" (a) + : "0" (a), "ir" (b) + : "cc" + ); + return(a); +} + +static __inline__ short GSM_SUB(short a, short b) +{ + __asm__ __volatile__( + "subw %2,%0; jno 0f; movw $0x7fff,%0; adcw $0,%0; 0:" + : "=r" (a) + : "0" (a), "ir" (b) + : "cc" + ); + return(a); +} + +#else + # define GSM_L_ADD(a, b) \ ( (a) < 0 ? ( (b) >= 0 ? (a) + (b) \ : (utmp = (ulongword)-((a) + 1) + (ulongword)-((b) + 1)) \ @@ -121,6 +159,8 @@ extern word gsm_asr P((word a, int n)); ((ltmp = (longword)(a) - (longword)(b)) >= MAX_WORD \ ? MAX_WORD : ltmp <= MIN_WORD ? MIN_WORD : ltmp) +#endif + # define GSM_ABS(a) ((a) < 0 ? ((a) == MIN_WORD ? MAX_WORD : -(a)) : (a)) /* Use these if necessary: |