Code cleanup

This commit is contained in:
Anthony Wang 2022-10-20 00:37:37 -04:00
parent 6ea6f9c1c6
commit a73b0c48a6
Signed by: a
GPG key ID: 42A5B952E6DD8D38

14
sd.c
View file

@ -17,7 +17,7 @@ int main(int argc, char* argv[]) {
{"file", required_argument, NULL, 'f'},
{"verbose", no_argument, NULL, 'v'}
};
while (1) {
while (true) {
int option_index = 0;
int c = getopt_long(argc, argv, "f:v", long_options, &option_index);
if (c == -1) break;
@ -86,15 +86,9 @@ int main(int argc, char* argv[]) {
/* Read user input */
b = getchar();
if (b == 'y') {
w >>= 1;
}
else if (b == 'n') {
w <<= 3;
}
else {
break;
}
if (b == 'y') w >>= 1;
else if (b == 'n') w <<= 3;
else break;
/* Update segment tree and database */
update(i, w, 0, N - 1, 1);