aboutsummaryrefslogtreecommitdiff
path: root/source/dsp1emu.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/dsp1emu.c')
-rw-r--r--source/dsp1emu.c8
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;
}