This bit made me wonder:
if( r & pbit )
r = ( r << 1 ) ^ 0x1021;
So the r = ( r << 1 ) ^ 0x1021 is run if (r & pbit) is not zero, where as looking at yours you're comparing (r & pbit) to see if it is zero:
if(r and pbit)=0 then
r := ( r shl 1 ) xor $1021
Oh and the obvious question since I haven't used Delphi, you have given a value to those variable such as len, p?