diff options
author | Andreas Eversberg <jolly@eversberg.eu> | 2017-01-24 07:59:09 +0100 |
---|---|---|
committer | Andreas Eversberg <jolly@eversberg.eu> | 2017-02-18 21:01:06 +0100 |
commit | 538a9591285bdc2604c5e05c06e4b2d776f4bdf9 (patch) | |
tree | 0eb989f5e8cd8490b5a4d46f55a3e2fbfd227f75 /src/amps | |
parent | 23a42aeb2c96058e5450805a8ce2d1955e09abd5 (diff) |
Indexing tables by casting index to unsigned integer only
Diffstat (limited to 'src/amps')
-rw-r--r-- | src/amps/dsp.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/amps/dsp.c b/src/amps/dsp.c index 7fcabcc..1a1e3d1 100644 --- a/src/amps/dsp.c +++ b/src/amps/dsp.c @@ -316,7 +316,7 @@ static int fsk_encode(amps_t *amps, char bit) if ((last & 1)) { /* last bit was 1, this bit is 1, so we ramp down first */ do { - *spl++ = ramp_down[(int)phase]; + *spl++ = ramp_down[(uint8_t)phase]; phase += bitstep; } while (phase < 256.0); phase -= 256.0; @@ -330,7 +330,7 @@ static int fsk_encode(amps_t *amps, char bit) } /* ramp up */ do { - *spl++ = ramp_up[(int)phase]; + *spl++ = ramp_up[(uint8_t)phase]; phase += bitstep; } while (phase < 256.0); phase -= 256.0; @@ -345,14 +345,14 @@ static int fsk_encode(amps_t *amps, char bit) } else { /* last bit was 0, this bit is 0, so we ramp up first */ do { - *spl++ = ramp_up[(int)phase]; + *spl++ = ramp_up[(uint8_t)phase]; phase += bitstep; } while (phase < 256.0); phase -= 256.0; } /* ramp down */ do { - *spl++ = ramp_down[(int)phase]; + *spl++ = ramp_down[(uint8_t)phase]; phase += bitstep; } while (phase < 256.0); phase -= 256.0; @@ -441,7 +441,7 @@ static void sat_encode(amps_t *amps, int16_t *samples, int length) for (i = 0; i < length; i++) { sample = *samples; - sample += dsp_sine_sat[((uint8_t)phase) & 0xff]; + sample += dsp_sine_sat[(uint8_t)phase]; if (sample > 32767) sample = 32767; else if (sample < -32767) @@ -464,7 +464,7 @@ static void test_tone_encode(amps_t *amps, int16_t *samples, int length) phase = amps->test_phase256; for (i = 0; i < length; i++) { - *samples++ = dsp_sine_test[((uint8_t)phase) & 0xff]; + *samples++ = dsp_sine_test[(uint8_t)phase]; phase += phaseshift; if (phase >= 256) phase -= 256; |