@@ -891,8 +891,13 @@ static void IntCodeFromCircuit(int which, void *any, char *stateInOut)
891
891
892
892
// This is a table of characters to transmit, as a function of the
893
893
// sequencer position (though we might have a hole in the middle
894
- // for the variable output)
895
- char outputChars[MAX_LOOK_UP_TABLE_LEN];
894
+ // for the variable output); positive is an unsigned character,
895
+ // negative is special flag values
896
+ enum {
897
+ OUTPUT_DIGIT = -1 ,
898
+ OUTPUT_SIGN = -2 ,
899
+ };
900
+ int outputChars[MAX_LOOK_UP_TABLE_LEN];
896
901
897
902
BOOL mustDoMinus = FALSE ;
898
903
@@ -917,7 +922,7 @@ static void IntCodeFromCircuit(int which, void *any, char *stateInOut)
917
922
p++;
918
923
if (*p == ' -' ) {
919
924
mustDoMinus = TRUE ;
920
- outputChars[steps++] = 1 ;
925
+ outputChars[steps++] = OUTPUT_SIGN ;
921
926
p++;
922
927
}
923
928
if (!isdigit (*p) || (*p - ' 0' ) > 5 || *p == ' 0' ) {
@@ -928,7 +933,7 @@ static void IntCodeFromCircuit(int which, void *any, char *stateInOut)
928
933
digits = (*p - ' 0' );
929
934
int i;
930
935
for (i = 0 ; i < digits; i++) {
931
- outputChars[steps++] = 0 ;
936
+ outputChars[steps++] = OUTPUT_DIGIT ;
932
937
}
933
938
} else if (*p == ' \\ ' ) {
934
939
p++;
@@ -960,7 +965,7 @@ static void IntCodeFromCircuit(int which, void *any, char *stateInOut)
960
965
break ;
961
966
}
962
967
} else {
963
- outputChars[steps++] = *p;
968
+ outputChars[steps++] = ( unsigned char ) *p;
964
969
}
965
970
if (*p) p++;
966
971
}
@@ -1013,7 +1018,7 @@ static void IntCodeFromCircuit(int which, void *any, char *stateInOut)
1013
1018
int i;
1014
1019
int digit = 0 ;
1015
1020
for (i = 0 ; i < steps; i++) {
1016
- if (outputChars[i] == 0 ) {
1021
+ if (outputChars[i] == OUTPUT_DIGIT ) {
1017
1022
// Note gross hack to work around limit of range for
1018
1023
// AVR brne op, which is +/- 64 instructions.
1019
1024
Op (INT_SET_VARIABLE_TO_LITERAL, " $scratch" , i);
@@ -1063,7 +1068,7 @@ static void IntCodeFromCircuit(int which, void *any, char *stateInOut)
1063
1068
Op (INT_END_IF);
1064
1069
1065
1070
digit++;
1066
- } else if (outputChars[i] == 1 ) {
1071
+ } else if (outputChars[i] == OUTPUT_SIGN ) {
1067
1072
// do the minus; ugliness to get around the BRNE jump
1068
1073
// size limit, though
1069
1074
Op (INT_SET_VARIABLE_TO_LITERAL, " $scratch" , i);
0 commit comments