From 537390db43b07eeee6f0bd776b0f6fb02aed631e Mon Sep 17 00:00:00 2001 From: Ahmet Inan Date: Fri, 21 Sep 2018 17:45:24 +0200 Subject: [PATCH] output debug messages to stderr --- bose_chaudhuri_hocquenghem_encoder.hh | 6 ++-- reed_solomon_encoder.hh | 12 ++++---- reed_solomon_error_correction.hh | 44 +++++++++++++-------------- 3 files changed, 31 insertions(+), 31 deletions(-) diff --git a/bose_chaudhuri_hocquenghem_encoder.hh b/bose_chaudhuri_hocquenghem_encoder.hh index 5c6d20a..4ae31d0 100644 --- a/bose_chaudhuri_hocquenghem_encoder.hh +++ b/bose_chaudhuri_hocquenghem_encoder.hh @@ -52,10 +52,10 @@ public: assert(!tmp); root *= pe; } - std::cout << "generator ="; + std::cerr << "generator ="; for (int i = 0; i <= NP; ++i) - std::cout << " " << (int)generator[i]; - std::cout << std::endl; + std::cerr << " " << (int)generator[i]; + std::cerr << std::endl; } } void operator()(ValueType *code) diff --git a/reed_solomon_encoder.hh b/reed_solomon_encoder.hh index 508dfdb..36e274f 100644 --- a/reed_solomon_encoder.hh +++ b/reed_solomon_encoder.hh @@ -32,18 +32,18 @@ public: } tmp[NR] = ValueType(1); if (0) { - std::cout << "generator = "; + std::cerr << "generator = "; for (int i = NR; i > 0; --i) { if (!tmp[i]) continue; if (tmp[i] != ValueType(1)) - std::cout << (int)tmp[i] << "*"; - std::cout << "x"; + std::cerr << (int)tmp[i] << "*"; + std::cerr << "x"; if (i != 1) - std::cout << "^" << i; - std::cout << " + "; + std::cerr << "^" << i; + std::cerr << " + "; } - std::cout << (int)tmp[0] << std::endl; + std::cerr << (int)tmp[0] << std::endl; } for (int i = 0; i <= NR; ++i) generator[i] = index(tmp[i]); diff --git a/reed_solomon_error_correction.hh b/reed_solomon_error_correction.hh index 14d52a1..d6fdfd2 100644 --- a/reed_solomon_error_correction.hh +++ b/reed_solomon_error_correction.hh @@ -212,45 +212,45 @@ struct ReedSolomonErrorCorrection static bool once; if (!once) { once = true; - std::cout << "syndromes ="; + std::cerr << "syndromes ="; for (int i = 0; i < NR; ++i) - std::cout << " " << (int)syndromes[i]; - std::cout << std::endl; - std::cout << "locator = "; + std::cerr << " " << (int)syndromes[i]; + std::cerr << std::endl; + std::cerr << "locator = "; for (int i = NR; i > 0; --i) { if (!locator[i]) continue; if (locator[i] != ValueType(1)) - std::cout << (int)locator[i] << "*"; - std::cout << "x"; + std::cerr << (int)locator[i] << "*"; + std::cerr << "x"; if (i != 1) - std::cout << "^" << i; - std::cout << " + "; + std::cerr << "^" << i; + std::cerr << " + "; } - std::cout << (int)locator[0] << std::endl; - std::cout << "locations ="; + std::cerr << (int)locator[0] << std::endl; + std::cerr << "locations ="; for (int i = 0; i < count; ++i) - std::cout << " " << (int)locations[i]; - std::cout << std::endl; - std::cout << "evaluator = "; + std::cerr << " " << (int)locations[i]; + std::cerr << std::endl; + std::cerr << "evaluator = "; for (int i = evaluator_degree; i > 0; --i) { if (!evaluator[i]) continue; if (evaluator[i] != ValueType(1)) - std::cout << (int)evaluator[i] << "*"; - std::cout << "x"; + std::cerr << (int)evaluator[i] << "*"; + std::cerr << "x"; if (i != 1) - std::cout << "^" << i; + std::cerr << "^" << i; if (i != 1 || evaluator[0]) - std::cout << " + "; + std::cerr << " + "; } if (evaluator[0]) - std::cout << (int)evaluator[0]; - std::cout << std::endl; - std::cout << "magnitudes ="; + std::cerr << (int)evaluator[0]; + std::cerr << std::endl; + std::cerr << "magnitudes ="; for (int i = 0; i < count; ++i) - std::cout << " " << (int)magnitudes[i]; - std::cout << std::endl; + std::cerr << " " << (int)magnitudes[i]; + std::cerr << std::endl; } } return count;