Clean up handling of bool -> int.

C++ standard says false -> 0, true -> 1.
This commit is contained in:
Jared Boone 2015-12-01 15:45:59 -08:00
parent 641b972b3e
commit c657ee3558

View File

@ -547,8 +547,8 @@ static FIL fil_tpms;
class ManchesterDecoder { class ManchesterDecoder {
public: public:
struct DecodedSymbol { struct DecodedSymbol {
bool value; uint_fast8_t value;
bool error; uint_fast8_t error;
}; };
constexpr ManchesterDecoder( constexpr ManchesterDecoder(
@ -601,10 +601,10 @@ static ManchesterFormatted format_manchester(
const auto symbol = decoder[i]; const auto symbol = decoder[i];
data <<= 1; data <<= 1;
data |= symbol.value ? 1 : 0; data |= symbol.value;
error <<= 1; error <<= 1;
error |= symbol.error ? 1 : 0; error |= symbol.error;
if( (i & 7) == 7 ) { if( (i & 7) == 7 ) {
hex_data += to_string_hex(data & 0xff, 2); hex_data += to_string_hex(data & 0xff, 2);