Commit fde567e3803f69614948b937c14184e0b6a0f308
authorMichel Pollet <buserror@gmail.com>
Thu, 6 Mar 2014 16:33:00 +0000 (16:33 +0000)
committerMichel Pollet <buserror@gmail.com>
Thu, 6 Mar 2014 16:36:57 +0000 (16:36 +0000)
You could pass constants over 8 bits in size, generating very confusing
values

Signed-off-by: Michel Pollet <buserror@gmail.com>
simavr/sim/avr/avr_mcu_section.h

index 68558eb530549d8f4a6e3f8ec720facd81937e4e..597858a9d7af10cb4e13312416ed7be07f932787 100644 (file)
@@ -187,9 +187,9 @@ struct avr_mmcu_vcd_trace_t {
  */
 #define AVR_MCU_EXTERNAL_PORT_PULL(_port, _mask, _val) \
        AVR_MCU_LONG(AVR_MMCU_TAG_PORT_EXTERNAL_PULL, \
-               (((unsigned long)(_port) << 16) | \
-               ((unsigned long)(_mask) << 8) | \
-               (_val)));
+               (((unsigned long)((_port)&0xff) << 16) | \
+               ((unsigned long)((_mask)&0xff) << 8) | \
+               ((_val)&0xff)));
 
 /*!
  * This tag allows you to specify the voltages used by your board