谁帮我把这段VB代码转换成Delphi代码 10
Functionsr(ByValx,ByValn)Ifn=0Thensr=xElseDimyy=xAnd&H7FFFFFFFDimzIfn=32-1Thenz=0Else...
Function sr(ByVal x, ByVal n)
If n = 0 Then
sr = x
Else
Dim y
y = x And &H7FFFFFFF
Dim z
If n = 32 - 1 Then
z = 0
Else
z = y \ CLng(2 ^ n)
End If
If y <> x Then
z = z Or CLng(2 ^ (32 - n - 1))
End If
sr = z
End If
End Function 展开
If n = 0 Then
sr = x
Else
Dim y
y = x And &H7FFFFFFF
Dim z
If n = 32 - 1 Then
z = 0
Else
z = y \ CLng(2 ^ n)
End If
If y <> x Then
z = z Or CLng(2 ^ (32 - n - 1))
End If
sr = z
End If
End Function 展开
1个回答
展开全部
function sr(x,n:DWord):DWord;
var
y,z:DWord;
begin
if n=0 then
Result := x
else begin
y := x and $7fffffff;
if n=32-1 then
z := 0
else
z := y div (2^n);
if y<>x then
z := z or (2^(32-n-1))
Result := z;
end;
end;
var
y,z:DWord;
begin
if n=0 then
Result := x
else begin
y := x and $7fffffff;
if n=32-1 then
z := 0
else
z := y div (2^n);
if y<>x then
z := z or (2^(32-n-1))
Result := z;
end;
end;
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询