T
tanminr
Unregistered / Unconfirmed
GUEST, unregistred user!
将下面的的C语言的代码转化为DELPHI中的代码,如何实现?
USHORT checkcontent(USHORT *buffer, int size)
{
unsigned long ckct=0;
while(size >1)
{
ckct+=*buffer++;
size -=sizeof(USHORT);
}
if(size )
{
ckct += *(UCHAR*)buffer;
}
ckct = (ckct >> 16) + (ckct &
0xffff);
ckct += (ckct >>16);
return (USHORT)(~ckct);
}
USHORT checkcontent(USHORT *buffer, int size)
{
unsigned long ckct=0;
while(size >1)
{
ckct+=*buffer++;
size -=sizeof(USHORT);
}
if(size )
{
ckct += *(UCHAR*)buffer;
}
ckct = (ckct >> 16) + (ckct &
0xffff);
ckct += (ckct >>16);
return (USHORT)(~ckct);
}