diff options
author | twinaphex | 2017-08-11 17:43:00 +0200 |
---|---|---|
committer | twinaphex | 2017-08-11 17:43:00 +0200 |
commit | b9c74ceb1352c8f433cf6bf2c446ae07457c5267 (patch) | |
tree | afd398fed3d08c81957373be55a12284cb932ab6 /source/dsp1emu.c | |
parent | 1aecedc999445e9a27e04f665fd562b576775d08 (diff) | |
download | snes9x2005-b9c74ceb1352c8f433cf6bf2c446ae07457c5267.tar.gz snes9x2005-b9c74ceb1352c8f433cf6bf2c446ae07457c5267.tar.bz2 snes9x2005-b9c74ceb1352c8f433cf6bf2c446ae07457c5267.zip |
Start making this suitable for MSVC and C89
Diffstat (limited to 'source/dsp1emu.c')
-rw-r--r-- | source/dsp1emu.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/source/dsp1emu.c b/source/dsp1emu.c index 3e34795..6ed470c 100644 --- a/source/dsp1emu.c +++ b/source/dsp1emu.c @@ -301,24 +301,28 @@ const int16_t DSP1_SinTable[256] = int16_t DSP1_Sin(int16_t Angle) { + int32_t S; + if (Angle < 0) { if (Angle == -32768) return 0; return -DSP1_Sin(-Angle); } - int32_t S = DSP1_SinTable[Angle >> 8] + (DSP1_MulTable[Angle & 0xff] * DSP1_SinTable[0x40 + (Angle >> 8)] >> 15); + S = DSP1_SinTable[Angle >> 8] + (DSP1_MulTable[Angle & 0xff] * DSP1_SinTable[0x40 + (Angle >> 8)] >> 15); if (S > 32767) S = 32767; return (int16_t) S; } int16_t DSP1_Cos(int16_t Angle) { + int32_t S; + if (Angle < 0) { if (Angle == -32768) return -32768; Angle = -Angle; } - int32_t S = DSP1_SinTable[0x40 + (Angle >> 8)] - (DSP1_MulTable[Angle & 0xff] * DSP1_SinTable[Angle >> 8] >> 15); + S = DSP1_SinTable[0x40 + (Angle >> 8)] - (DSP1_MulTable[Angle & 0xff] * DSP1_SinTable[Angle >> 8] >> 15); if (S < -32768) S = -32767; return (int16_t) S; } |