aboutsummaryrefslogtreecommitdiff
path: root/sd.c
diff options
context:
space:
mode:
authorAnthony Wang2022-10-20 00:37:37 -0400
committerAnthony Wang2022-10-20 00:37:37 -0400
commita73b0c48a60bb96306e9c5ef7351200cb04ee03d (patch)
tree35865ccdbeb53aa24403723f6d649527826565f4 /sd.c
parent6ea6f9c1c60c7025e0b7bdc95a5d5aa395eedfbc (diff)
Code cleanup
Diffstat (limited to 'sd.c')
-rw-r--r--sd.c14
1 files 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);