|
[求助]怎么用C语言实现左右逻辑移位
逻辑移位:(unsigned)>> 和 (unsigned)<< 算术移位:(signed)>> 和 (signed)<< int main(void) { int x = 0xabcd; unsigned int y = 0xdcba; x<<=2; //与 (signed int)x<<=2; 相同,因为变量本身是signed (unsigned int)x<<=2; x>>=2; (unsigned int)x>>=2; (signed int)y<<=2; y<<=2; (signed int)y>>=2; y>>=2; return x+y; } 汇编结果: _TEXT segment byte public 'CODE' assume cs:_TEXT,ds:DGROUP _main proc near ?debug C E80105312E63707012AD422B ; ; int main(void) ; push bp mov bp,sp ; ; { ; int x = 0xabcd; ; mov dx,-21555 ; ; unsigned int y = 0xdcba; ; mov bx,-9030 ; ; ; x<<=2; ; shl dx,2 ; ; (unsigned int)x<<=2; ; shl dx,2 ; ; x>>=2; ; sar dx,2 ; ; (unsigned int)x>>=2; ; shr dx,2 ; ; ; (signed)y<<=2; ; shl bx,2 ; ; y<<=2; ; shl bx,2 ; ; (signed)y>>=2; ; sar bx,2 ; ; y>>=2; ; shr bx,2 ; ; ; return x+y; ; mov ax,dx add ax,bx ; ; } ; pop bp ret _main endp ?debug C E9 ?debug C FA00000000 _TEXT ends 因为算术左移和逻辑左移的结果一样,所以都编译成逻辑的,而右移不同,编译结果也不同 |
|
|
|
帮忙破解一下这个东西我想学习这本电子书
lz违规了!! |
|
[原创]Easy Mail 3.1.58.2 简单分析
来膜拜LZ!! 支持好文章! |
|
[原创]闪电-视频转换王 5.2.0 算法分析
其实用DEDE找按钮事件很容易。我的方法只是记住关键字或先在其他资源编辑器找它模块的名字! 我这里载入OD时在程序找到一个regform这个名是我们注册窗口的名所以只在里面找一下确定按钮就ok了!关键就是要知道我们需要找按钮的窗口名字!! |
|
[原创]闪电-视频转换王 5.2.0 算法分析
没人顶自己顶自己!! |
|
[求助]如何OD中断按钮按键
如果是其他语言写的那么用什么方法? |
|
|
操作理由
RANk
{{ user_info.golds == '' ? 0 : user_info.golds }}
雪币
{{ experience }}
课程经验
{{ score }}
学习收益
{{study_duration_fmt}}
学习时长
基本信息
荣誉称号:
{{ honorary_title }}
能力排名:
No.{{ rank_num }}
等 级:
LV{{ rank_lv-100 }}
活跃值:
在线值:
浏览人数:{{ visits }}
最近活跃:{{ last_active_time }}
注册时间:{{ user_info.create_date_jsonfmt }}
勋章
兑换勋章
证书
证书查询 >
能力值