type
pinteger=^integer;
// 整块右移 shift=0-31
procedure shrb(var buffer
len: integer
shift: byte);
var
tail: integer;
temp1,temp2: inetger;
tailLen: byte;
P: pinteger;
i: integer;
begin
tailLen:=len and 3;
tail:=pinteger(pchar(@buffer)+len-taillen)^;
len:=len shr 2;
p:=pinteger(@buffer);
temp1:=0;
for i:=1 to len do
begin
temp2:=p^;
p^ := p^ shr shift or temp1;
temp1:=temp2 shl (32-shift);
p:=pinteger(pchar(p)+length(inetger));
end;
tail:=tail shr shift or temp1;
move(p^, tail, taillen);
end;
// 整块左移 shift=0-31
procedure shlb(var buffer
len: integer
shift: byte);
var
tail,temp1: integer;
tailLen: byte;
P: pinteger;
i: integer;
begin
tailLen:=len and 3;
tail:=pinteger(pchar(@buffer)+len-taillen)^and (-1 shl (32-taillen shl 3));
len:=len shr 2;
p:=pinteger(@buffer);
for i:=1 to len-1 do
begin
temp1:=pinteger(pchar(pointer(p))+4)^ shr (32-shift);
p^ := p^ shl shift or temp1;
p:=pinteger(pchar(pointer(p))+4);
end;
if len>0 then
begin
p^:=p^ shl shift or (tail shr (32-shift));
p:=pinteger(pchar(pointer(p))+4);
end;
tail:=tail shl shift;
move(p^, tail, taillen);
end;