请高手转换C代码到delphi. void reverseBytes(char *bytes, long length) { long halfLen = (length>>1);
voidreverseBytes(char*bytes,longlength){longhalfLen=(length>>1);char*end=bytes+length...
void reverseBytes(char *bytes, long length)
{
long halfLen = (length>>1);
char *end = bytes+length;
char c;
while (--halfLen >= 0)
{
c = *bytes;
*bytes++ = *--end;
*end = c;
}
}
这个函数的用处就是把一个char数组元素反转。希望高手帮助转为delphi。 展开
{
long halfLen = (length>>1);
char *end = bytes+length;
char c;
while (--halfLen >= 0)
{
c = *bytes;
*bytes++ = *--end;
*end = c;
}
}
这个函数的用处就是把一个char数组元素反转。希望高手帮助转为delphi。 展开
展开全部
procedure reverseBytes( pbSource : PByte; nByteCount : Integer );
var
i : Integer;
Q : PByte;
B : Byte;
begin
Q := pbSource;
Inc( Q, nByteCount - 1 );
for i := 1 to nByteCount div 2 do
begin
B := pbSource^;
pbSource^ := Q^;
Q^ := B;
Inc( pbSource );
Dec( Q );
end;
end;
var
i : Integer;
Q : PByte;
B : Byte;
begin
Q := pbSource;
Inc( Q, nByteCount - 1 );
for i := 1 to nByteCount div 2 do
begin
B := pbSource^;
pbSource^ := Q^;
Q^ := B;
Inc( pbSource );
Dec( Q );
end;
end;
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询