shithub: rgbds

Download patch

ref: e05321356b68a1736d5d304bab0ee2bc4b39b7bf
parent: 0778959e986928a08d55729626e200fcbefa2569
author: ISSOtm <eldredhabert0@gmail.com>
date: Mon Aug 31 17:33:53 EDT 2020

Fix truncation warning when adding charmap mapping

It used to warn when mapping negative values

--- a/src/asm/asmy.y
+++ b/src/asm/asmy.y
@@ -1090,10 +1090,10 @@
 ;
 
 charmap		: T_POP_CHARMAP string ',' const {
-			if (($4 & 0xFF) != $4)
+			if ($4 < INT8_MIN || $4 > UINT8_MAX)
 				warning(WARNING_TRUNCATION, "Expression must be 8-bit");
 
-			if (charmap_Add($2, $4 & 0xFF) == -1)
+			if (charmap_Add($2, (uint8_t)$4) == -1)
 				yyerror("Error adding new charmap mapping: %s\n", strerror(errno));
 		}
 ;