From a87669fead1172ebff3c68b4f436e3e829efdcdd Mon Sep 17 00:00:00 2001 From: markster Date: Tue, 24 Apr 2001 02:02:21 +0000 Subject: Version 0.1.8 from FTP git-svn-id: http://svn.digium.com/svn/asterisk/trunk@295 f38db490-d61c-443f-a65b-d21fe96a405b --- codecs/gsm/inc/private.h | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'codecs/gsm/inc/private.h') 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: -- cgit v1.2.3