From 25e693cc46324b4ec588530de542bba8af6f47c6 Mon Sep 17 00:00:00 2001 From: skal Date: Sat, 31 Jan 2026 21:11:11 +0100 Subject: style: add vertical compression rules to clang-format - Enabled AllowShortFunctionsOnASingleLine: All - Enabled AllowShortBlocksOnASingleLine: Always - Enabled AllowShortIfStatementsOnASingleLine: Always - Enabled AllowShortLoopsOnASingleLine: true - Set MaxEmptyLinesToKeep: 1 - Applied formatting to all source files. --- tools/asset_packer.cc | 12 ++++-------- tools/seq_compiler.cc | 10 +++------- tools/spectool.cc | 4 +--- tools/specview.cc | 7 ++----- 4 files changed, 10 insertions(+), 23 deletions(-) (limited to 'tools') diff --git a/tools/asset_packer.cc b/tools/asset_packer.cc index 6e939cf..4a2e631 100644 --- a/tools/asset_packer.cc +++ b/tools/asset_packer.cc @@ -59,20 +59,17 @@ int main(int argc, char *argv[]) { std::vector asset_names; while (std::getline(assets_txt_file, line)) { - if (line.empty() || line[0] == '#') - continue; + if (line.empty() || line[0] == '#') continue; size_t first_comma = line.find(','); - if (first_comma == std::string::npos) - continue; + if (first_comma == std::string::npos) continue; std::string asset_name = line.substr(0, first_comma); asset_name.erase(0, asset_name.find_first_not_of(" \t\r\n")); asset_name.erase(asset_name.find_last_not_of(" \t\r\n") + 1); size_t second_comma = line.find(',', first_comma + 1); - if (second_comma == std::string::npos) - continue; + if (second_comma == std::string::npos) continue; std::string filename = line.substr(first_comma + 1, second_comma - first_comma - 1); @@ -102,8 +99,7 @@ int main(int argc, char *argv[]) { assets_data_cc_file << "static const uint8_t ASSET_DATA_" << asset_name << "[] = {"; for (size_t i = 0; i < buffer.size(); ++i) { - if (i % 12 == 0) - assets_data_cc_file << "\n "; + if (i % 12 == 0) assets_data_cc_file << "\n "; assets_data_cc_file << "0x" << std::hex << (int)buffer[i] << std::dec << (i == buffer.size() - 1 ? "" : ", "); } diff --git a/tools/seq_compiler.cc b/tools/seq_compiler.cc index 4846244..e84877b 100644 --- a/tools/seq_compiler.cc +++ b/tools/seq_compiler.cc @@ -24,8 +24,7 @@ struct SequenceEntry { std::string trim(const std::string &str) { size_t first = str.find_first_not_of(" "); - if (std::string::npos == first) - return str; + if (std::string::npos == first) return str; size_t last = str.find_last_not_of(" "); return str.substr(first, (last - first + 1)); } @@ -52,8 +51,7 @@ int main(int argc, char *argv[]) { while (std::getline(in_file, line)) { line_num++; std::string trimmed = trim(line); - if (trimmed.empty() || trimmed[0] == '#') - continue; + if (trimmed.empty() || trimmed[0] == '#') continue; std::stringstream ss(trimmed); std::string command; @@ -87,9 +85,7 @@ int main(int argc, char *argv[]) { // Remove leading whitespace from getline if any (getline reads the space // after priority) extra_args = trim(extra_args); - if (!extra_args.empty()) { - extra_args = ", " + extra_args; - } + if (!extra_args.empty()) { extra_args = ", " + extra_args; } current_seq->effects.push_back( {class_name, start, end, priority, extra_args}); diff --git a/tools/spectool.cc b/tools/spectool.cc index 97c5997..5c05a03 100644 --- a/tools/spectool.cc +++ b/tools/spectool.cc @@ -57,9 +57,7 @@ int analyze_audio(const char *in_path, const char *out_path) { } // Apply window - for (int i = 0; i < DCT_SIZE; ++i) { - pcm_chunk[i] *= window[i]; - } + for (int i = 0; i < DCT_SIZE; ++i) { pcm_chunk[i] *= window[i]; } // Apply FDCT float dct_chunk[DCT_SIZE]; diff --git a/tools/specview.cc b/tools/specview.cc index d2f5489..59b6d70 100644 --- a/tools/specview.cc +++ b/tools/specview.cc @@ -64,11 +64,8 @@ int main(int argc, char **argv) { // Find max magnitude for normalization float max_mag = 0.0f; - for (float val : spec_data) { - max_mag = std::max(max_mag, fabsf(val)); - } - if (max_mag == 0.0f) - max_mag = 1.0f; // Avoid division by zero + for (float val : spec_data) { max_mag = std::max(max_mag, fabsf(val)); } + if (max_mag == 0.0f) max_mag = 1.0f; // Avoid division by zero // ASCII visualization const char *gradient = " .:-=+*#%@"; -- cgit v1.2.3