diff rvinterf/tmsh/l1resp.c @ 155:f5a797c291be

fc-tmsh l1tm response handling: returned values can be signed or unsigned
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 17 Mar 2017 05:47:00 +0000
parents 79e71354ba7b
children
line wrap: on
line diff
--- a/rvinterf/tmsh/l1resp.c	Mon Mar 06 01:43:59 2017 +0000
+++ b/rvinterf/tmsh/l1resp.c	Fri Mar 17 05:47:00 2017 +0000
@@ -84,8 +84,12 @@
 		return;
 	}
 	val = rvi_msg[5] | (rvi_msg[6] << 8);
-	sprintf(buf, "%s index %u (0x%02X): %u (0x%04X)", op,
-		rvi_msg[4], rvi_msg[4], val, val);
+	if (val >= 0x8000)
+		sprintf(buf, "%s index %u (0x%02X): 0x%04X (%u or %d)", op,
+			rvi_msg[4], rvi_msg[4], val, val, (int)val - 65536);
+	else
+		sprintf(buf, "%s index %u (0x%02X): 0x%04X (%u)", op,
+			rvi_msg[4], rvi_msg[4], val, val);
 	async_msg_output(buf);
 }