diff options
author | mattf <mattf@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-02-10 23:37:27 +0000 |
---|---|---|
committer | mattf <mattf@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-02-10 23:37:27 +0000 |
commit | 00dd1704f15d77f4b5ca3694493812b8e49a8696 (patch) | |
tree | 57c12cf4eda0931613bfedd345484014eeabeb2f /codecs/gsm/inc | |
parent | 864716935ab085c63a1d6f1bef5beae1dbc76d97 (diff) |
Lots of little fixes for doing MSVC compiling codecs in windows (#6022)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@9450 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'codecs/gsm/inc')
-rw-r--r-- | codecs/gsm/inc/private.h | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/codecs/gsm/inc/private.h b/codecs/gsm/inc/private.h index b7115ae51..24f0b42b2 100644 --- a/codecs/gsm/inc/private.h +++ b/codecs/gsm/inc/private.h @@ -136,6 +136,11 @@ static __inline__ short GSM_SUB(short a, short b) #else +#ifdef WIN32 +#define inline __inline +#define __inline__ __inline +#endif + # define GSM_L_ADD(a, b) \ ( (a) < 0 ? ( (b) >= 0 ? (a) + (b) \ : (utmp = (ulongword)-((a) + 1) + (ulongword)-((b) + 1)) \ @@ -144,25 +149,19 @@ static __inline__ short GSM_SUB(short a, short b) : (utmp = (ulongword)(a) + (ulongword)(b)) >= MAX_LONGWORD \ ? MAX_LONGWORD : utmp)) -/* - * # define GSM_ADD(a, b) \ - * ((ltmp = (longword)(a) + (longword)(b)) >= MAX_WORD \ - * ? MAX_WORD : ltmp <= MIN_WORD ? MIN_WORD : ltmp) - */ -/* Nonportable, but faster: */ - -# define GSM_ADD(a, b) ({ \ - register longword ltmp; \ - ltmp = (longword) (a) + (longword) (b); \ - ((ulongword) (ltmp - MIN_WORD) > MAX_WORD - MIN_WORD ? \ - (ltmp > 0 ? MAX_WORD : MIN_WORD) : ltmp); \ - }) - -#define GSM_SUB(a, b) ({ \ - register longword ltmp; \ - ltmp = (longword) (a) - (longword) (b); \ - (ltmp >= MAX_WORD ? MAX_WORD : ltmp <= MIN_WORD ? MIN_WORD : ltmp); \ - }) +static inline word GSM_ADD(a, b) +{ + register longword ltmp; + ltmp = (longword) (a) + (longword) (b); + return (word)((ulongword) (ltmp - MIN_WORD) > MAX_WORD - MIN_WORD ? (ltmp > 0 ? MAX_WORD : MIN_WORD) : ltmp); +}; + +static inline word GSM_SUB(a, b) +{ + register longword ltmp; + ltmp = (longword) (a) - (longword) (b); + return (word)(ltmp >= MAX_WORD ? MAX_WORD : ltmp <= MIN_WORD ? MIN_WORD : ltmp); +}; #endif |