1
0
Fork 0

Add compiler testing for always_inline attribute

Add compiler testing for fastcall attribute
Add the FASTCALL define to visual c
Remove some overkill inline routines
Make sure that all the inline routines in headers are static


Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3355
This commit is contained in:
Sjoerd van der Berg 2009-04-25 16:25:03 +00:00
parent 5f6236ee35
commit 88caf1dc71
20 changed files with 182 additions and 147 deletions

View file

@ -218,26 +218,26 @@ static inline Bits MakeVolume( Bitu wave, Bitu volume ) {
return (sig >> exp);
};
static Bits FASTCALL WaveForm0( Bitu i, Bitu volume ) {
static Bits DB_FASTCALL WaveForm0( Bitu i, Bitu volume ) {
Bits neg = 0 - (( i >> 9) & 1);//Create ~0 or 0
Bitu wave = SinTable[i & 511];
return (MakeVolume( wave, volume ) ^ neg) - neg;
}
static Bits FASTCALL WaveForm1( Bitu i, Bitu volume ) {
static Bits DB_FASTCALL WaveForm1( Bitu i, Bitu volume ) {
Bit32u wave = SinTable[i & 511];
wave |= ( ( (i ^ 512 ) & 512) - 1) >> ( 32 - 12 );
return MakeVolume( wave, volume );
}
static Bits FASTCALL WaveForm2( Bitu i, Bitu volume ) {
static Bits DB_FASTCALL WaveForm2( Bitu i, Bitu volume ) {
Bitu wave = SinTable[i & 511];
return MakeVolume( wave, volume );
}
static Bits FASTCALL WaveForm3( Bitu i, Bitu volume ) {
static Bits DB_FASTCALL WaveForm3( Bitu i, Bitu volume ) {
Bitu wave = SinTable[i & 255];
wave |= ( ( (i ^ 256 ) & 256) - 1) >> ( 32 - 12 );
return MakeVolume( wave, volume );
}
static Bits FASTCALL WaveForm4( Bitu i, Bitu volume ) {
static Bits DB_FASTCALL WaveForm4( Bitu i, Bitu volume ) {
//Twice as fast
i <<= 1;
Bits neg = 0 - (( i >> 9) & 1);//Create ~0 or 0
@ -245,18 +245,18 @@ static Bits FASTCALL WaveForm4( Bitu i, Bitu volume ) {
wave |= ( ( (i ^ 512 ) & 512) - 1) >> ( 32 - 12 );
return (MakeVolume( wave, volume ) ^ neg) - neg;
}
static Bits FASTCALL WaveForm5( Bitu i, Bitu volume ) {
static Bits DB_FASTCALL WaveForm5( Bitu i, Bitu volume ) {
//Twice as fast
i <<= 1;
Bitu wave = SinTable[i & 511];
wave |= ( ( (i ^ 512 ) & 512) - 1) >> ( 32 - 12 );
return MakeVolume( wave, volume );
}
static Bits FASTCALL WaveForm6( Bitu i, Bitu volume ) {
static Bits DB_FASTCALL WaveForm6( Bitu i, Bitu volume ) {
Bits neg = 0 - (( i >> 9) & 1);//Create ~0 or 0
return (MakeVolume( 0, volume ) ^ neg) - neg;
}
static Bits FASTCALL WaveForm7( Bitu i, Bitu volume ) {
static Bits DB_FASTCALL WaveForm7( Bitu i, Bitu volume ) {
//Negative is reversed here
Bits neg = (( i >> 9) & 1) - 1;
Bitu wave = (i << 3);

View file

@ -40,7 +40,7 @@ struct Operator;
struct Channel;
#if (DBOPL_WAVE == WAVE_HANDLER)
typedef Bits ( FASTCALL *WaveHandler) ( Bitu i, Bitu volume );
typedef Bits ( DB_FASTCALL *WaveHandler) ( Bitu i, Bitu volume );
#endif
typedef Bits ( DBOPL::Operator::*VolumeHandler) ( );
@ -247,4 +247,4 @@ struct Handler : public Adlib::Handler {
};
}; //Namespace
}; //Namespace

View file

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: mixer.cpp,v 1.50 2009-03-19 20:45:42 c2woody Exp $ */
/* $Id: mixer.cpp,v 1.51 2009-04-25 16:25:03 harekiet Exp $ */
/*
Remove the sdl code from here and have it handeld in the sdlmain.
@ -55,7 +55,7 @@
#define MIXER_REMAIN ((1<<MIXER_SHIFT)-1)
#define MIXER_VOLSHIFT 13
static inline Bit16s MIXER_CLIP(Bits SAMP) {
static INLINE Bit16s MIXER_CLIP(Bits SAMP) {
if (SAMP < MAX_AUDIO) {
if (SAMP > MIN_AUDIO)
return SAMP;
@ -175,7 +175,7 @@ void MixerChannel::AddSilence(void) {
}
template<class Type,bool stereo,bool signeddata,bool nativeorder>
INLINE void MixerChannel::AddSamples(Bitu len, const Type* data) {
inline void MixerChannel::AddSamples(Bitu len, const Type* data) {
Bits diff[2];
Bitu mixpos=mixer.pos+done;
freq_index&=MIXER_REMAIN;