关于BSF和BSR

竞天问 2011-09-11 10:23:22
在我的电脑上执行如下代码:
void main()
{
int a = 8;
_asm
{
mov eax , a;
bsr ebx, eax;
mov a, ebx;
}

cout<<a<<endl;
}

输出是3;但是如果把bsr改成bsf输出还是3,这是什么情况?
Win7x64,VS2010 Win32编译平台
...全文
184 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
竞天问 2011-09-12
  • 打赏
  • 举报
回复
OK,我明白了,谢谢两位!
fox000002 2011-09-12
  • 打赏
  • 举报
回复
扫描是一个向左一个向右

但是位的编号都是从低位起
竞天问 2011-09-12
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 fox000002 的回复:]

计数都是从低位计数的

8 对应为 1 的只有 3 这个位置 (00001000B)
[/Quote]
那bsf和bsr这两个指令有什么区别,不是一个从前计数一个从后计数吗?
fox000002 2011-09-11
  • 打赏
  • 举报
回复
计数都是从低位计数的

8 对应为 1 的只有 3 这个位置 (00001000B)
MSL 即 Microsoft Library 是 DOS 版的 "WinHelp",也就是现代版 Help Viewer 的始祖。 安装目录下有个 ini 文件,用来指定图书的路径,它即是目录。 文件来源自 http://wdl2.winworldpc.com/Abandonware%20SDKs/Microsoft Programmer's Library 1.3.7z Microsoft Programmer's Library 1.3.iso 这就是 DOS 版的 MSDN!使用 DOSBOX 就可以运行此库。此库含一大古董级MS官方编程参考材料,主要针对 Windows 3.0 平台,真可谓之应用尽有: MS Windows 3.0 SDK Guide to Programming MS Windows 3.0 SDK Install. & Update Guide MS Windows 3.0 SDK Programmer's Reference Vol. 1 MS Windows 3.0 SDK Programmer's Reference Vol. 2 MS Windows 3.0 SDK Tools MS Windows 3.0 SDK Articles All MS Windows 3.0 SDK Manuals MS Windows 3.0 DDK Install. & Update Guide MS Windows 3.0 DDK Adaptation Guide MS Windows 3.0 DDK Virtual Device Adapt. Guide MS Windows 3.0 DDK Printer & Font Kit All MS Windows 3.0 DDK Manuals MS Online User's Guide Programming MS Windows MS Windows Sample Code MS KnowledgeBase - MS Windows 以及 Options => Library 菜单下提供的 9 个重要的参考资料,其中就有 C 和 MASM 这些重要的参考资料。这些是已安装的目录部分,鉴于 MASM 的重要性,特将其添加到压缩包内,免CD运行: Windows References OS/S References Network References MS-DOS References MS Systems Journal Hardware References C References MASM References BASIC References Pascal References FORTUAN References 其中 C References 和 MASM References 包含: Installing and Using MS MASM 6.0 MS MASM 6.0 Reference MS MASM 6.0 Programmer's Guide MS MASM 6.0 White Paper QuickAssembler 2.01 Programmer's Guide MS Mixed-Language Programming Guide CodeView & Utilities User's Guide MS Editor User's Guide MS OnLine User's Guide MASM Sample Code MS KnowledgeBase - MASM MS C 6.0 Advanced Programming Techniques MS C 6.0 Installing and Using the P.D.S. MS C 6.0 Reference MS C 6.0 Run-Time Library Reference MS C 6.0 Developer's Toolkit Reference QuickC 2.5 Tool Kit QuickC 2.5 C for Yourself QuickC 2.5 Up and Running QuickC 2.5 Update MS Professional
You are visitor as of October 17, 1996.The Art of Assembly Language ProgrammingForward Why Would Anyone Learn This Stuff?1 What's Wrong With Assembly Language2 What's Right With Assembly Language?3 Organization of This Text and Pedagogical Concerns4 Obtaining Program Source Listings and Other Materials in This TextSection One: Machine OrganizationArt of Assembly Language: Chapter OneChapter One - Data Representation1.0 - Chapter Overview1.1 - Numbering Systems1.1.1 - A Review of the Decimal System1.1.2 - The Binary Numbering System1.1.3 - Binary Formats1.2 - Data Organization1.2.1 - Bits1.2.2 - Nibbles1.2.3 - Bytes1.2.4 - Words1.2.5 - Double Words1.3 - The Hexadecimal Numbering System1.4 - Arithmetic Operations on Binary and Hexadecimal Numbers1.5 - Logical Operations on Bits1.6 - Logical Operations on Binary Numbers and Bit Strings1.7 - Signed and Unsigned Numbers1.8 - Sign and Zero Extension1.9 - Shifts and Rotates1.10 - Bit Fields and Packed Data1.11 - The ASCII Character Set1.12 Summary1.13 Laboratory Exercises1.13.1 Installing the Software1.13.2 Data Conversion Exercises1.13.3 Logical Operations Exercises1.13.4 Sign and Zero Extension Exercises1.13.5 Packed Data Exercises1.14 Questions1.15 Programming ProjectsChapter Two - Boolean Algebra2.0 - Chapter Overview2.1 - Boolean Algebra2.2 - Boolean Functions and Truth Tables2.3 - Algebraic Manipulation of Boolean Expressions2.4 - Canonical Forms2.5 - Simplification of Boolean Functions2.6 - What Does This Have To Do With Computers, Anyway?2.6.1 - Correspondence Between Electronic Circuits and Boolean Functions2.6.2 - Combinatorial Circuits2.6.3 - Sequential and Clocked Logic2.7 - Okay, What Does It Have To Do With Programming, Then?2.8 - Generic Boolean Functions2.9 Laboratory Exercises<

3,881

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 其它技术问题
社区管理员
  • 其它技术问题社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧