From fde567e3803f69614948b937c14184e0b6a0f308 Mon Sep 17 00:00:00 2001 From: Michel Pollet Date: Thu, 6 Mar 2014 16:33:00 +0000 Subject: [PATCH] ELF: Make sure the macro generater the correct value You could pass constants over 8 bits in size, generating very confusing values Signed-off-by: Michel Pollet --- simavr/sim/avr/avr_mcu_section.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/simavr/sim/avr/avr_mcu_section.h b/simavr/sim/avr/avr_mcu_section.h index 68558eb..597858a 100644 --- a/simavr/sim/avr/avr_mcu_section.h +++ b/simavr/sim/avr/avr_mcu_section.h @@ -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 -- 2.39.5