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/cnetz/dsp.c | |
parent | 23a42aeb2c96058e5450805a8ce2d1955e09abd5 (diff) |
Indexing tables by casting index to unsigned integer only
Diffstat (limited to 'src/cnetz/dsp.c')
-rw-r--r-- | src/cnetz/dsp.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/cnetz/dsp.c b/src/cnetz/dsp.c index ae453c6..d3a3c69 100644 --- a/src/cnetz/dsp.c +++ b/src/cnetz/dsp.c @@ -253,12 +253,12 @@ static int fsk_testtone_encode(cnetz_t *cnetz) /* add 198 bits of test tone */ for (i = 0; i < 99; i++) { do { - *spl++ = ramp_up[(int)phase]; + *spl++ = ramp_up[(uint8_t)phase]; phase += bitstep; } while (phase < 256.0); phase -= 256.0; do { - *spl++ = ramp_down[(int)phase]; + *spl++ = ramp_down[(uint8_t)phase]; phase += bitstep; } while (phase < 256.0); phase -= 256.0; @@ -346,14 +346,14 @@ static int fsk_block_encode(cnetz_t *cnetz, const char *bits) if (bits[i] == '1') { /* ramp up from 0 */ do { - *spl++ = ramp_up[(int)phase] / 2 + deviation / 2; + *spl++ = ramp_up[(uint8_t)phase] / 2 + deviation / 2; phase += bitstep; } while (phase < 256.0); phase -= 256.0; } else { /* ramp down from 0 */ do { - *spl++ = ramp_down[(int)phase] / 2 - deviation / 2; + *spl++ = ramp_down[(uint8_t)phase] / 2 - deviation / 2; phase += bitstep; } while (phase < 256.0); phase -= 256.0; @@ -370,7 +370,7 @@ static int fsk_block_encode(cnetz_t *cnetz, const char *bits) } else { /* ramp down */ do { - *spl++ = ramp_down[(int)phase]; + *spl++ = ramp_down[(uint8_t)phase]; phase += bitstep; } while (phase < 256.0); phase -= 256.0; @@ -380,7 +380,7 @@ static int fsk_block_encode(cnetz_t *cnetz, const char *bits) if (bits[i] == '1') { /* ramp up */ do { - *spl++ = ramp_up[(int)phase]; + *spl++ = ramp_up[(uint8_t)phase]; phase += bitstep; } while (phase < 256.0); phase -= 256.0; @@ -400,14 +400,14 @@ static int fsk_block_encode(cnetz_t *cnetz, const char *bits) if (last == '0') { /* ramp up to 0 */ do { - *spl++ = ramp_up[(int)phase] / 2 - deviation / 2; + *spl++ = ramp_up[(uint8_t)phase] / 2 - deviation / 2; phase += bitstep; } while (phase < 256.0); phase -= 256.0; } else { /* ramp down to 0 */ do { - *spl++ = ramp_down[(int)phase] / 2 + deviation / 2; + *spl++ = ramp_down[(uint8_t)phase] / 2 + deviation / 2; phase += bitstep; } while (phase < 256.0); phase -= 256.0; @@ -481,14 +481,14 @@ static int fsk_distributed_encode(cnetz_t *cnetz, const char *bits) if (bits[i * 4 + j] == '1') { /* ramp up from 0 */ do { - *spl++ = ramp_up[(int)phase] / 2 + deviation / 2; + *spl++ = ramp_up[(uint8_t)phase] / 2 + deviation / 2; phase += bitstep; } while (phase < 256.0); phase -= 256.0; } else { /* ramp down from 0 */ do { - *spl++ = ramp_down[(int)phase] / 2 - deviation / 2; + *spl++ = ramp_down[(uint8_t)phase] / 2 - deviation / 2; phase += bitstep; } while (phase < 256.0); phase -= 256.0; @@ -505,7 +505,7 @@ static int fsk_distributed_encode(cnetz_t *cnetz, const char *bits) } else { /* ramp down */ do { - *spl++ = ramp_down[(int)phase]; + *spl++ = ramp_down[(uint8_t)phase]; phase += bitstep; } while (phase < 256.0); phase -= 256.0; @@ -515,7 +515,7 @@ static int fsk_distributed_encode(cnetz_t *cnetz, const char *bits) if (bits[i * 4 + j] == '1') { /* ramp up */ do { - *spl++ = ramp_up[(int)phase]; + *spl++ = ramp_up[(uint8_t)phase]; phase += bitstep; } while (phase < 256.0); phase -= 256.0; @@ -535,14 +535,14 @@ static int fsk_distributed_encode(cnetz_t *cnetz, const char *bits) if (last == '0') { /* ramp up to 0 */ do { - *spl++ = ramp_up[(int)phase] / 2 - deviation / 2; + *spl++ = ramp_up[(uint8_t)phase] / 2 - deviation / 2; phase += bitstep; } while (phase < 256.0); phase -= 256.0; } else { /* ramp down to 0 */ do { - *spl++ = ramp_down[(int)phase] / 2 + deviation / 2; + *spl++ = ramp_down[(uint8_t)phase] / 2 + deviation / 2; phase += bitstep; } while (phase < 256.0); phase -= 256.0; |