Change interface to AccessCodeCorrelator, inline in header.

This commit is contained in:
Jared Boone 2015-09-25 22:24:43 -07:00
parent a3cce5632e
commit 5c31e803c8
3 changed files with 10 additions and 12 deletions

View File

@ -32,13 +32,3 @@ void AccessCodeCorrelator::configure(
maximum_hamming_distance = new_maximum_hamming_distance;
}
}
bool AccessCodeCorrelator::execute(
const uint_fast8_t in
) {
history = (history << 1) | (in & 1);
const auto delta_bits = (history ^ code) & mask;
//const size_t count = __builtin_popcountll(delta_bits);
const size_t count = __builtin_popcountl(delta_bits);
return (count <= maximum_hamming_distance);
}

View File

@ -33,7 +33,15 @@ public:
const size_t new_maximum_hamming_distance
);
bool execute(const uint_fast8_t in);
bool operator()(
const uint_fast8_t in
) {
history = (history << 1) | (in & 1);
const auto delta_bits = (history ^ code) & mask;
//const size_t count = __builtin_popcountll(delta_bits);
const size_t count = __builtin_popcountl(delta_bits);
return (count <= maximum_hamming_distance);
}
private:
uint32_t code { 0 };

View File

@ -107,7 +107,7 @@ void FSKProcessor::consume_symbol(
const uint_fast8_t sliced_symbol = (raw_symbol >= 0.0f) ? 1 : 0;
const auto decoded_symbol = nrzi_decode(sliced_symbol);
const bool access_code_found = access_code_correlator.execute(decoded_symbol);
const bool access_code_found = access_code_correlator(decoded_symbol);
packet_builder.execute(
decoded_symbol,