"GPF" wrote:
Also how to I expand the rdXOR(i7%,rdXOR(i6%,rdXOR(i5%,i4%))) call so I can get rid of the function calls overhead?
Figured that out, still looking for any other performance improvement tips.
Thanks,
Troy
updateSlice8CRC: function(num as integer, buf as object) as integer
crc% = num
lastn% = buf.count() - 1
n%=0
k%=0
while (lastn% >=8)
current% = buf.GetSignedByte(n%):n%=n%+1
current0% =( (crc% and not current%) or (not crc% and current% ) ) and &hFF
current% = buf.GetSignedByte(n%):n%=n%+1
shiftedc%= ((crc% and &hFFFFFF00)/256) and &hFFFFFF
current1% =( (shiftedc% and not current%) or (not shiftedc% and current% ) ) and &hFF
current% = buf.GetSignedByte(n%):n%=n%+1
shiftedc%= ((crc% and &hFFFF0000)/65536) and &hFFFFFF
current2% =( (shiftedc% and not current%) or (not shiftedc% and current% ) ) and &hFF
current% = buf.GetSignedByte(n%):n%=n%+1
shiftedc%= ((crc% and &hFF000000)/16777216) and &hFFFFFF
current3% =( (shiftedc% and not current%) or (not shiftedc% and current% ) ) and &hFF
i7% = m.crc32Lookup[7][current0%]
i6% = m.crc32Lookup[6][current1%]
i5% = m.crc32Lookup[5][current2%]
i4% = m.crc32Lookup[4][current3%]
'crc%= rdXOR(i7%,rdXOR(i6%,rdXOR(i5%,i4%)))
'c0%= ( (i5% and not i4%) or (not i5% and i4% ) )
'c1%= ( (i6% and not c0%) or (not i6% and c0% ) )
'crc%=( (i7% and not c1%) or (not i7% and c1% ) )
crc%=( (i7% and not ( (i6% and not ( (i5% and not i4%) or (not i5% and i4% ) )) or (not i6% and ( (i5% and not i4%) or (not i5% and i4% ) ) ) )) or (not i7% and ( (i6% and not ( (i5% and not i4%) or (not i5% and i4% ) )) or (not i6% and ( (i5% and not i4%) or (not i5% and i4% ) ) ) ) ) )
i3% = m.crc32Lookup[3][buf.GetSignedByte(n%)]:n%=n%+1
i2% = m.crc32Lookup[2][buf.GetSignedByte(n%)]:n%=n%+1
i1% = m.crc32Lookup[1][buf.GetSignedByte(n%)]:n%=n%+1
i0% = m.crc32Lookup[0][buf.GetSignedByte(n%)]:n%=n%+1
'crc%= rdXOR(crc%,rdXOR(i3%,rdXOR(i2%,rdXOR(i1%,i0%))))
'c0%= ( (i1% and not i0%) or (not i1% and i0% ) )
'c1%= ( (i2% and not c0%) or (not i2% and c0% ) )
'c2%= ( (i3% and not c1%) or (not i3% and c1% ) )
'crc%=( (crc% and not c2%) or (not crc% and c2% ) )
crc%=( (crc% and not ( (i3% and not ( (i2% and not ( (i1% and not i0%) or (not i1% and i0% ) )) or (not i2% and ( (i1% and not i0%) or (not i1% and i0% ) ) ) )) or (not i3% and ( (i2% and not ( (i1% and not i0%) or (not i1% and i0% ) )) or (not i2% and ( (i1% and not i0%) or (not i1% and i0% ) ) ) ) ) )) or (not crc% and ( (i3% and not ( (i2% and not ( (i1% and not i0%) or (not i1% and i0% ) )) or (not i2% and ( (i1% and not i0%) or (not i1% and i0% ) ) ) )) or (not i3% and ( (i2% and not ( (i1% and not i0%) or (not i1% and i0% ) )) or (not i2% and ( (i1% and not i0%) or (not i1% and i0% ) ) ) ) ) ) ) )
lastn%=lastn%-8
k%=n%
end while
for n% = k% to buf.count() - 1
current% = buf.GetSignedByte(n%)':?n%
index% = ( (crc% and not current%) or (not crc% and current% ) ) and &hFF
shiftedc% = ((crc% and &hFFFFFF00)/256) and &hFFFFFF
crc% = ( (shiftedc% and not m.crc32Lookup[0][index%] ) or (not shiftedc% and m.crc32Lookup[0][index%]))
end for
return crc%
end function