Hi, On Sat, Jan 07, 2006 at 12:12:05PM -0000, Prof A Olowofoyeku (The African Chief) wrote:
Which I have half-translated into this: for (; length; length + (length shr 8)) do crc := (crc shl 8) XOR crctab[((crc shr 24) XOR length) AND $FF];
As you can see, I don't understand the for-loop ...
for() loops in C are actually best translated into while loops first: for( start; condition; increment ) { block; } translates to: start; while( condition ) { block; increment; } so in this case, the C statement for(; length; length >>= 8) crc =(crc << 8) ^ crctab[((crc >> 24) ^ length) & 0xFF]; can be translated to: /* no loop initialization */ while( length != 0 ) { crc := (crc shl 8) XOR crctab[((crc shr 24) XOR length) AND $FF]; length := length shr 8; } ("variable >>= bits" is the same as "variable = variable >> bits") My pascal is too rusty to get the syntax for the actual "while" loop right, but I think with the C explanations, you should be able to translate the rest :-) gert -- USENET is *not* the non-clickable part of WWW! //www.muc.de/~gert/ Gert Doering - Munich, Germany gert@greenie.muc.de fax: +49-89-35655025 gert@net.informatik.tu-muenchen.de