CRC32得出负数问题
xtuwz 2009-01-13 03:03:22 '得到数组的CRC32值
Public Function GetByteArrayCrc32(ByRef buffer() As Byte) As Long
Dim crc32Result As Long
crc32Result = &HFFFFFFFF
Dim i As Integer
Dim iLookup As Integer
For i = LBound(buffer) To UBound(buffer)
iLookup = (crc32Result And &HFF) Xor buffer(i)
crc32Result = ((crc32Result And &HFFFFFF00) \ &H100) And 16777215
crc32Result = crc32Result Xor crc32Table(iLookup)
Next i
GetByteArrayCrc32 = Not (crc32Result)
End Function
Dim myByte(0 To 3094) As Byte
Dim j As Integer
myByte(0) = FristByte(Ts_Data(iArray).Table_Id)
myByte(1) = SecondByte(Ts_Data(iArray).Section_Syntax_Indicator, Ts_Data(iArray).Reserved_Feature_Use3, Ts_Data(iArray).Section_Length)
....
myByte(22) = Desc_13Byte(Ts_Data(iArray).TS_Descriptor.Last_Table_Id, Ts_Data(iArray).TS_Descriptor.Reserved_Feature_Use3)
For j = 0 To 3071
myByte(23 + j) = Ts_Data(iArray).Payload_Data(j)
Next
Dim cCRC32 As New cCRC32
Dim CRC As Long
rResult = cCRC32.GetByteArrayCrc32(myByte())
SectionCRC = rResult'竟然得出个负值为-2122749930
是不是有问题,这个问题怎么处理