1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-27 16:31:31 +00:00

Switches the MFM shifter to unsigned accumulation.

Since left shifting signed numbers is undefined behaviour.
This commit is contained in:
Thomas Harte 2017-10-17 22:12:04 -04:00
parent 91b867a7b3
commit 2d7a4fe5f0
2 changed files with 4 additions and 4 deletions

View File

@ -24,7 +24,7 @@ void Shifter::set_should_obey_syncs(bool should_obey_syncs) {
}
void Shifter::add_input_bit(int value) {
shift_register_ = (shift_register_ << 1) | value;
shift_register_ = (shift_register_ << 1) | static_cast<unsigned int>(value);
bits_since_token_++;
token_ = Token::None;

View File

@ -40,10 +40,10 @@ class Shifter {
private:
// Bit stream input state
int bits_since_token_ = 0;
int shift_register_ = 0;
unsigned int shift_register_ = 0;
bool is_awaiting_marker_value_ = false;
bool should_obey_syncs_;
Token token_;
bool should_obey_syncs_ = true;
Token token_ = None;
// input configuration
bool is_double_density_ = false;