I'm working on an embedded project for an ARM based microcontroller. In one function, I'm casting six 1-byte integers into two words with 0xFFFF to make up the empty space. The lines are below:
Code:
report_addr[0] = (0xFFFF)<<16 | p_adv_report->peer_addr.addr[0]<<8 | p_adv_report->peer_addr.addr[1];
report_addr[1] = p_adv_report->peer_addr.addr[2]<<24 | p_adv_report->peer_addr.addr[3]<<16 | p_adv_report->peer_addr.addr[4]<<8 | p_adv_report->peer_addr.addr[5];
report_addr is an array of uint32.
peer_addr.addr is an array of uint8.
My compilers is giving me this warning:
#61-D: integer operation result is out of range.
Seems like there's exactly two bytes of data fitting into a 2-byte word. Why is this spitting out a warning? I'd like the project to build without the warning, if possible.