ModbusPoll::processSpecialParam(ParameterDef pTable, char * val, unsigned short * ptr_buffIndex)
/* some code here */
unsigned short modbus_reg_40045_save_value;
modbus_reg_40045_save_value = * ( (unsigned short *) val ) ;
* ( ( unsigned short * ) val - 1 ) = 0x0003 & modbus_reg_40045_save_value ;
My doubt is if I'm correctly typecasting val to point to 2 bytes, then subtract one from val.
The pointer that is result of subtraction needs to point to 2 bytes so 2 bytes can be
The code above seems to store two bytes in location pointed to by computed address but how does it know to strore two bytes when I don't explicitly typecast resultant pointer to unsigned short?