From e4159856ad6406d5df4077cb0a41263b7e54b5bb Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Mon, 27 Mar 2023 07:29:30 -0700 Subject: simplify skip logic --- backomp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/backomp b/backomp index ae9bbce..13a4b3c 100755 --- a/backomp +++ b/backomp @@ -3,7 +3,9 @@ set -e ! read -rd '' FILTER_AWK <<'EOF' -function flr(n, s) { return int(n / s) * s } +function flr(n, s) { + return int(n / s) * s +} BEGIN { len = split("h d w m", arr) @@ -31,12 +33,13 @@ BEGIN { for (i = 1; i <= n_buckets; ++i) { b = buckets[i] - if (skip = (repl[b] && bt[b] == last[b, b])) { + if (repl[b] && bt[b] == last[b, b]) { for (j = 1; j < i; ++j) { - skip = (bt[buckets[j]] != last[b, buckets[j]]) - if (!skip) break + if (bt[buckets[j]] == last[b, buckets[j]]) + break } - if (skip) next + if (j == i) + next } if ((b, bt[b]) in bkeep || ret[b] == "*" || bc[b]++ < ret[b]) @@ -52,7 +55,8 @@ END { ++keep[bkeep[i]] asorti(keep) - for (i in keep) print keep[i] + for (i in keep) + print keep[i] } EOF -- cgit v1.2.3-70-g09d2