port: fix REG_SET() compiler warning.

Compiler
rtl837x_port.c:466: warning 116: right shifting more than size of object changed to zero

provided value is a uint16. So shifting it more then 16 cause this error.
Solution: cast the value to uint32_t.
This commit is contained in:
René van Dorst
2025-09-11 07:36:01 +02:00
parent 8ff124af30
commit f148bdad20
2 changed files with 7 additions and 7 deletions
+6 -6
View File
@@ -158,9 +158,9 @@
#ifdef REGDBG
#define REG_SET(r, v) SFR_DATA_24 = ((v) >> 24) & 0xff; \
SFR_DATA_16 = ((v) >> 16) & 0xff; \
SFR_DATA_8 = ((v) >> 8 & 0xff); \
#define REG_SET(r, v) SFR_DATA_24 = (((uint32_t)v) >> 24) & 0xff; \
SFR_DATA_16 = (((uint32_t)v) >> 16) & 0xff; \
SFR_DATA_8 = (((uint16_t)v) >> 8 & 0xff); \
SFR_DATA_0 = (v) & 0xff; \
reg_write(r); \
write_char('R'); print_byte(r >> 8); print_byte(r); write_char('-'); \
@@ -173,9 +173,9 @@
reg_write(r); \
write_char('R'); print_byte(r>>8); print_byte(r); write_char('-'); print_byte(v24); print_byte(v16); print_byte(v8); print_byte(v0); write_char(' ');
#else
#define REG_SET(r, v) SFR_DATA_24 = ((v) >> 24) & 0xff; \
SFR_DATA_16 = ((v) >> 16) & 0xff; \
SFR_DATA_8 = ((v) >> 8 & 0xff); \
#define REG_SET(r, v) SFR_DATA_24 = (((uint32_t)v) >> 24) & 0xff; \
SFR_DATA_16 = (((uint32_t)v) >> 16) & 0xff; \
SFR_DATA_8 = (((uint16_t)v) >> 8 & 0xff); \
SFR_DATA_0 = (v) & 0xff; \
reg_write(r);
+1 -1
View File
@@ -26,4 +26,4 @@ Other memory:
---------------- -------- -------- -------- --------
PAGED EXT. RAM 0 256
EXTERNAL RAM 0x0001 0x1b28 6952 16777216
ROM/EPROM/FLASH 0x0000 0x1b84f 44052 16777216
ROM/EPROM/FLASH 0x0000 0x1b85c 44065 16777216