diff options
| author | Max Horn | 2009-02-21 18:13:03 +0000 | 
|---|---|---|
| committer | Max Horn | 2009-02-21 18:13:03 +0000 | 
| commit | 11b2ddfc5450fda4638dd264f576e48d17d85b12 (patch) | |
| tree | edf4320f66fcd88a1a751ac83c4e6a94334296c1 | |
| parent | 3cd9706c63330403e8d9ef3071697909bbb1f652 (diff) | |
| download | scummvm-rg350-11b2ddfc5450fda4638dd264f576e48d17d85b12.tar.gz scummvm-rg350-11b2ddfc5450fda4638dd264f576e48d17d85b12.tar.bz2 scummvm-rg350-11b2ddfc5450fda4638dd264f576e48d17d85b12.zip | |
SCI: Simplified gcd (and fixed crash when a = 0, not that it would be relevant ;)
svn-id: r38715
| -rw-r--r-- | engines/sci/sfx/mixer/soft.cpp | 20 | 
1 files changed, 7 insertions, 13 deletions
| diff --git a/engines/sci/sfx/mixer/soft.cpp b/engines/sci/sfx/mixer/soft.cpp index bf76268356..6e70be6eea 100644 --- a/engines/sci/sfx/mixer/soft.cpp +++ b/engines/sci/sfx/mixer/soft.cpp @@ -92,19 +92,13 @@ static int mix_init(sfx_pcm_mixer_t *self, sfx_pcm_device_t *device) {  	return SFX_OK;  } -static inline unsigned int gcd(unsigned int a, unsigned int b) { -	if (a == b) -		return a; - -	if (a < b) { -		unsigned int c = b % a; - -		if (!c) -			return a; - -		return gcd(c, a); -	} else -		return gcd(b, a); +static inline uint gcd(uint a, uint b) { +	while (a) { +		uint c = b % a; +		b = a; +		a = c; +	} +	return b;  }  static sfx_pcm_urat_t urat(unsigned int nom, unsigned int denom) { | 
