Explorar el Código

fixed undefined behaviour when left shifting a negative number

Tom Mittendorf hace 2 años
padre
commit
24b638b5d4
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  1. 1 1
      Firmware/Dcodes.cpp

+ 1 - 1
Firmware/Dcodes.cpp

@@ -584,7 +584,7 @@ void dcode_9()
 			if (code_seen('V')) // value to be written as simulated
 			{
 				adc_sim_mask |= (1 << index);
-				adc_values[index] = (((int)code_value()) << 4);
+				adc_values[index] = ((uint16_t)code_value_short() << 4);
 				printf_P(PSTR("ADC%d=%4d\n"), index, adc_values[index] >> 4);
 			}
 		}