Fix conversion of binary digits to hex, when generating code.
authorMario de Sousa <msousa@fe.up.pt>
Mon, 30 May 2011 19:28:32 +0100
changeset 308 833cb2eba36f
parent 307 6ea381792f59
child 309 f93bcada0f51
Fix conversion of binary digits to hex, when generating code.
stage4/generate_c/generate_c_base.cc
--- a/stage4/generate_c/generate_c_base.cc	Mon May 30 19:24:09 2011 +0100
+++ b/stage4/generate_c/generate_c_base.cc	Mon May 30 19:28:32 2011 +0100
@@ -132,7 +132,7 @@
 	  bit_mult /= 2;
 	  value += bit_mult * ((token->value[i] == '0')? 0:1);
 	  if (bit_mult == 1) {
-	    str[0] = (value <= 9)? (char)'0' + value : (char)'A' + value;
+	    str[0] = (value <= 9)? (char)'0' + value : (char)'A' + value - 10;
 	    s4o.print(str);
             bit_mult = 0x10;
             value = 0;