tweaks: change a 'switch' to 'if', to elide a dummy 'return'
parent
a0d2e63c8e
commit
6980cfbf70
|
@ -845,27 +845,24 @@ int assemble_byte_code(int kbinput)
|
||||||
{
|
{
|
||||||
static int byte = 0;
|
static int byte = 0;
|
||||||
|
|
||||||
switch (++digit_count) {
|
if (++digit_count == 1) {
|
||||||
case 1:
|
|
||||||
/* The first digit is either 0, 1, or 2. */
|
/* The first digit is either 0, 1, or 2. */
|
||||||
byte = (kbinput - '0') * 100;
|
byte = (kbinput - '0') * 100;
|
||||||
return PROCEED;
|
return PROCEED;
|
||||||
case 2:
|
} else if (digit_count == 2) {
|
||||||
/* The second digit may be at most 5 if the first was 2. */
|
/* The second digit may be at most 5 if the first was 2. */
|
||||||
if (byte < 200 || kbinput <= '5') {
|
if (byte < 200 || kbinput <= '5') {
|
||||||
byte += (kbinput - '0') * 10;
|
byte += (kbinput - '0') * 10;
|
||||||
return PROCEED;
|
return PROCEED;
|
||||||
} else
|
} else
|
||||||
return kbinput;
|
return kbinput;
|
||||||
case 3:
|
} else {
|
||||||
/* The third digit may be at most 5 if first two were 2 and 5. */
|
/* The third digit may be at most 5 if first two were 2 and 5. */
|
||||||
if (byte < 250 || kbinput <= '5') {
|
if (byte < 250 || kbinput <= '5') {
|
||||||
return (byte + kbinput - '0');
|
return (byte + kbinput - '0');
|
||||||
} else
|
} else
|
||||||
return kbinput;
|
return kbinput;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0; /* FIXME: this suppresses a compilation warning */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Translate a normal ASCII character into its corresponding control code.
|
/* Translate a normal ASCII character into its corresponding control code.
|
||||||
|
|
Loading…
Reference in New Issue