The Block Check Code (BCC) is calculated as follows:
; assume:
; msg_length = Number of bytes in message over which the BCC
is calculated.
; msg_ptr = Pointer to the first byte (start of message char) of
; the message.
VAR
i : integer; snp_bcc : byte;
BODY
i = 0;
snp_bcc = 0;
while ( i < msg_length)
snp_bcc = snp_bcc XOR (byte contents at (msg_ptr + i))
rotate snp_bcc left by 1; 8-bit rotate (ROTATE HIGH BIT TO LOW BIT)
i = i+1
end while
END BODY
谁可解释一下上面的校验码计算程序。尤其下面二句:
snp_bcc = snp_bcc XOR (byte contents at (msg_ptr + i))
rotate snp_bcc left by 1; 8-bit rotate (ROTATE HIGH BIT TO LOW BIT)
计算结果是奇、偶还是和校验。最后结果在snp_bcc中吗?我对语言不太熟。
|