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 ......
c# 有没有用于C/S的 html文本编辑器
就像web界面的文本内容编辑器
up
C/S还要编译器干嘛啊
又不用控制样式
貌似没有吧 如果有了通知下我 我也要liujintaohfbb@163.com我的邮箱 ......
C#如何判断连接sql server数据库成功?
try
{
connection.connect()
return true;
}
catch()
{
return false;
}
楼主很着急,开了几贴了。
引用
try
{
connection.connect( ......
我在模块里自定义了一个函数:stradd()
可是在adoquery1.sql.add('select stradd(author) from book');
时提示stradd未定义...
这个问题有什么办法可以解决的吗? 非常感激!
(在A ......