From 538a9591285bdc2604c5e05c06e4b2d776f4bdf9 Mon Sep 17 00:00:00 2001 From: Andreas Eversberg Date: Tue, 24 Jan 2017 07:59:09 +0100 Subject: Indexing tables by casting index to unsigned integer only --- src/anetz/dsp.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/anetz/dsp.c') diff --git a/src/anetz/dsp.c b/src/anetz/dsp.c index ee5bdd7..a680366 100644 --- a/src/anetz/dsp.c +++ b/src/anetz/dsp.c @@ -254,10 +254,10 @@ static void fsk_paging_tone(anetz_t *anetz, int16_t *samples, int length) } for (i = 0; i < length; i++) { - sample = (int32_t)dsp_sine_tone[((uint8_t)phase[0]) & 0xff] - + (int32_t)dsp_sine_tone[((uint8_t)phase[1]) & 0xff] - + (int32_t)dsp_sine_tone[((uint8_t)phase[2]) & 0xff] - + (int32_t)dsp_sine_tone[((uint8_t)phase[3]) & 0xff]; + sample = (int32_t)dsp_sine_tone[(uint8_t)phase[0]] + + (int32_t)dsp_sine_tone[(uint8_t)phase[1]] + + (int32_t)dsp_sine_tone[(uint8_t)phase[2]] + + (int32_t)dsp_sine_tone[(uint8_t)phase[3]]; *samples++ = sample / 4.0 * anetz->page_gain; phase[0] += phaseshift[0]; phase[1] += phaseshift[1]; @@ -300,12 +300,12 @@ static void fsk_paging_tone_sequence(anetz_t *anetz, int16_t *samples, int lengt while (length) { /* use tone, but during transition of tones, keep phase 0 degrees (high level) until next tone reaches 0 degrees (high level) */ if (!transition) - *samples++ = dsp_sine_tone[((uint8_t)phase[tone]) & 0xff] * anetz->page_gain; + *samples++ = dsp_sine_tone[(uint8_t)phase[tone]] * anetz->page_gain; else { /* fade between old an new tone */ *samples++ - = (double)dsp_sine_tone[((uint8_t)phase[(tone - 1) & 3]) & 0xff] * (double)(transition - count) / (double)transition / 2.0 * anetz->page_gain - + (double)dsp_sine_tone[((uint8_t)phase[tone]) & 0xff] * (double)count / (double)transition / 2.0 * anetz->page_gain; + = (double)dsp_sine_tone[(uint8_t)phase[(tone - 1) & 3]] * (double)(transition - count) / (double)transition / 2.0 * anetz->page_gain + + (double)dsp_sine_tone[(uint8_t)phase[tone]] * (double)count / (double)transition / 2.0 * anetz->page_gain; } phase[0] += phaseshift[0]; phase[1] += phaseshift[1]; @@ -350,7 +350,7 @@ static void fsk_tone(anetz_t *anetz, int16_t *samples, int length) phase = anetz->tone_phase256; for (i = 0; i < length; i++) { - *samples++ = dsp_sine_tone[((uint8_t)phase) & 0xff]; + *samples++ = dsp_sine_tone[(uint8_t)phase]; phase += phaseshift; if (phase >= 256) phase -= 256; -- cgit v1.2.3