Dint:=(fbuf[p] shl 56) or (fbuf[p+1] shl 48) or (fbuf[p+2] shl 40) or (fbuf[p+3] shl 32) or (fbuf[p+4] shl 24) or (fbuf[p+5] shl 16) or (fbuf[p+6] shl 8) or fbuf[p+7];
(Dint:int64 fbuf:array of byte)
p:=p+8;
这样编译时提示出错信息:"Constant expression violates subrange bounds"
错在那串表达式
是怎么回事
帮帮忙~~看一下
(Dint:int64 fbuf:array of byte)
p:=p+8;
这样编译时提示出错信息:"Constant expression violates subrange bounds"
错在那串表达式
是怎么回事
帮帮忙~~看一下
解决方案 »
- 新手求救:delphi+sql server+word文档(可以单独给分) 急!!!!!
- 用ADOquery怎么使用存储过程,?
- COM组件如何封装成ActiveX
- 怎么恢复.pas文件?
- 请问各位大侠运行时创建的表单,为什么不能ShowModal只能Show,如何解决?
- mts/com+问题
- 如何用delphi管理linux主机下的某个文本文件。
- win2000+delphi6.0+sql Server2000 更新时出问题(query+UpdateSQL)
- 我考了MCSD,去哪里找工作呀,谢谢提建议!
- 如何在Delphi中得到所有的错误
- Delphi7.0晕晕中~
- 如何在EHLIB的DBGridEh中加一个复选框进行多选
总共就8位哦~~~~~
int:=(fbuf[p] shl 24) or (fbuf[p+1] shl 16) or (fbuf[p+2] shl 8) or fbuf[p+3];
能通过啊~不错啊~
好奇怪
int:=(fbuf[p] shl 24) or (fbuf[p+1] shl 16) or (fbuf[p+2] shl 8) or fbuf[p+3];
能通过啊~不错啊~这是因为byte类型最多只能 shl 32,超过就会出错。
begin
{$IFDEF DotNet}
Result := System.BitConverter.GetBytes(AValue);
{$ELSE}
SetLength(Result, SizeOf(Int64));
PInt64(@Result[0])^ := AValue;
{$ENDIF}
end;function BytesToInt64(const AValue: TBytes ): Int64;
begin
{$IFDEF DotNet}
Result := System.BitConverter.ToInt64(AValue,0);
{$ELSE}
Result := PInt64(@AValue[0])^;
{$ENDIF}
end;
Dint:=(int64(fbuf[p]) shl 56) or (int64(fbuf[p+1]) shl 48) or (int64(fbuf[p+2]) shl 40) or (int64(fbuf[p+3]) shl 32) or (int64(fbuf[p+4]) shl 24) or (int64(fbuf[p+5]) shl 16) or (int64(fbuf[p+6]) shl 8) or int64(fbuf[p+7]);
asm
MOV EDX, [EAX];
MOV EAX, [EAX + 4]; BSWAP EDX;
BSWAP EAX;
end;procedure Test;
var
a: array of Byte;
i: integer;
i64: Int64;
begin
SetLength(a, 8);
for i := 0 to 7 do
a[i] := (i + 1) * $11;
i64 := Swap64(a);
dialogs.ShowMessage(IntToHex(i64, 8));
end;