util/spkmodem-recv: tidy up pulse decoding

make it clearer about next/old, in the loop. this also
improves performance on older systems (cache the values
first, don't re-calculate)

again, this is GNU code. but you wouldn't know it, in my
current version. i forked this from GRUB several years
ago and started cleaning it for fun.

Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2026-03-12 04:55:18 +00:00
parent 1953812efd
commit 62a496ec9e
+7 -3
View File
@@ -152,10 +152,14 @@ static void
decode_pulse(struct decoder_state *st) decode_pulse(struct decoder_state *st)
{ {
size_t n; size_t n;
unsigned char old_ring, old_sep;
st->freq_data -= st->pulse[st->ringpos]; old_ring = st->pulse[st->ringpos];
st->freq_data += st->pulse[st->sep_pos]; old_sep = st->pulse[st->sep_pos];
st->freq_separator -= st->pulse[st->sep_pos];
st->freq_data -= old_ring;
st->freq_data += old_sep;
st->freq_separator -= old_sep;
n = fread(&st->frame[st->ringpos], sizeof(st->frame[0]), 1, stdin); n = fread(&st->frame[st->ringpos], sizeof(st->frame[0]), 1, stdin);
if (n != 1) { if (n != 1) {