delphi 与 C# 位运算 有好大区别,请教各位!
delphi 函数:
function RB(A: longint): longint;
begin
Result := (A shr 24) or ((A shr 8) and $FF00) or ((A shl 8) and $FF0000) or (A shl 24);
end;
我转成C#:
private int RB(int A) {
return (A >> 24) | ((A >> 8) & 0xFF00) | ((A < < 8) & 0xFF0000) | (A < < 24);
}
结果很奇怪:
我的A值为:-2143996893
delphi 的结果是: 590624128
c#:-128
请各位帮尽快分析一下我是否转错了,谢谢~!
溢出了?
但 delphi 的结果是没有溢出的啊?
delphi是longint,你找找c#的对应类型
longint 就是 integer,对应 C# int 这个应该没有错。
查过好像是一样,那就不清楚了
非常感谢!
相关问答:
//C 接口
extern "C"
{
TESSDLL_API int __cdecl GetTessText(const char *imagefile, char *text);
}
//我在C#中声明
//调用C DLL 中的函数
[DllImport("OCRapi.dll&quo ......
我在模块里自定义了一个函数:stradd()
可是在adoquery1.sql.add('select stradd(author) from book');
时提示stradd未定义...
这个问题有什么办法可以解决的吗? 非常感激!
(在A ......
谢谢了。最好有代码
Insert into Table2(field1,field2,...) select value1,value2,... from Table1
insert into 表一 select * from 表二
如果字段不一致,要指定字段
insert into 表一(A,B) se ......
delphi如何向Access数据表中自定义字段?然后显示到DBGrid中
怎么没人理我呀
分分忒少咧,一般人都懒得进来……*^_^*
SQL
creat table TableName(ID Counter Primary Key,FieldName varchar(20))
ADOQue ......