# HG changeset patch # User Michael Pavone # Date 1504060964 25200 # Node ID 9c65819afec3cf98bf15a0bebdd69cd93f94a84e # Parent 08bc099a622faf9809e5287ceb0bca9128b63dc1 Fix operator precedence in psg serialize/deserialize diff -r 08bc099a622f -r 9c65819afec3 psg.c --- a/psg.c Tue Aug 29 19:42:14 2017 -0700 +++ b/psg.c Tue Aug 29 19:42:44 2017 -0700 @@ -174,11 +174,11 @@ load_buffer16(buf, context->counters, 4); load_buffer8(buf, context->volume, 4); uint8_t output_state = load_int8(buf); - context->output_state[0] = output_state & 8 >> 3; - context->output_state[1] = output_state & 4 >> 2; - context->output_state[2] = output_state & 2 >> 1; + context->output_state[0] = output_state >> 3 & 1; + context->output_state[1] = output_state >> 2 & 1; + context->output_state[2] = output_state >> 1 & 1; context->output_state[3] = output_state & 1; - context->noise_use_tone = output_state & 0x10 >> 4; + context->noise_use_tone = output_state >> 4 & 1; context->noise_type = load_int8(buf); context->latch = load_int8(buf); context->cycles = load_int32(buf);