Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ InTouch HMI

左移位 (SHL),右移位 (SHR)

  • Last UpdatedSep 24, 2024
  • 1 minute read

SHL 和 SHR 是只使用整型运算数的二进制运算符。此运算符左侧的质量引用的 32 位词语的二进制内容会移位(向左或向右),移动位数是在运算符右侧的质量中指定的。

移到词语之外的位会丢失。移走后腾空的位用零填充。该移位是无正负号的移位。

示例 1

If Attribute2 = 00000111 (decimal 7)

然后是操作:

Attribute1 = Attribute2 SHL 3;

结果:

Attribute1 = 00111000 (decimal 56)

示例 2

If Attribute2 = 00001011 (decimal 11)

然后是操作:

Attribute1 = Attribute2 SHR 2;

结果:

Attribute1 = 00000010 (decimal 2)

In This Topic