SA0053: Too big bitwise shiftPermalink

Detects whether or not the data type width of the operand has been exceeded in the case of a bitwise shift (bit shift) of operands

Justification: If a shift operation exceeds the data type width, then a constant ‎0‎ is generated. If a rotation shift exceeds the data type width, then it is difficult to read. Therefore, the rotation value should be shortened.

Importance: High

Example

PROGRAM PLC_PRG
VAR
	byTemp1 : BYTE;
	wTemp2 : WORD;
	dwTemp3 : DWORD;
	lwTemp4 : LWORD;
END_VAR
byTemp1 := SHR(byTemp1, BYTE#25);
wTemp2 := SHL(wTemp2, BYTE#45);
dwTemp3 := ROR(dwTemp3, BYTE#78);
lwTemp4 := ROL(lwTemp4, BYTE#111);

--> SA0053: Too big bitwise shift