changeset 1451:9c65819afec3

Fix operator precedence in psg serialize/deserialize
author Michael Pavone <pavone@retrodev.com>
date Tue, 29 Aug 2017 19:42:44 -0700
parents 08bc099a622f
children f284ad74afe1
files psg.c
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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);