From a73b0c48a60bb96306e9c5ef7351200cb04ee03d Mon Sep 17 00:00:00 2001 From: Anthony Wang Date: Thu, 20 Oct 2022 00:37:37 -0400 Subject: [PATCH] Code cleanup --- sd.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/sd.c b/sd.c index 21caa57..f28004a 100644 --- a/sd.c +++ b/sd.c @@ -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);