⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ffsalib.s

📁 vxworks源码源码解读是学习vxworks的最佳途径
💻 S
字号:
/* ffsALib.s - i80x86 find first set function *//* Copyright 1984-1993 Wind River Systems, Inc. */	.data	.globl  _copyright_wind_river	.long   _copyright_wind_river/*modification history--------------------01c,01jun93,hdn  updated to 5.1.		  - fixed #else and #endif		  - changed VOID to void		  - changed ASMLANGUAGE to _ASMLANGUAGE		  - changed copyright notice01b,13oct92,hdn  debugged.01a,07apr92,hdn  written based on TRON version.*//*DESCRIPTIONThis module defines an optimized version of the C routine in ffsLib.c.By taking advantage of the BSR instruction of 80X86 processors, theimplementation determines the first bit set in constant time.*/#define _ASMLANGUAGE#include "vxWorks.h"#include "asm.h"#if defined(PORTABLE)#define ffsALib_PORTABLE#endif#ifndef ffsALib_PORTABLE	/* exports */	.globl	_ffsMsb	.text	.align 4/********************************************************************************* ffsMsb - find first set bit (searching from the most significant bit)** This routine finds the first bit set in the argument passed it and* returns the index of that bit.  Bits are numbered starting* at 1 from the least signifficant bit.  A return value of zero indicates that* the value passed is zero.** RETURNS: bit position ...* int ffsMsb (i)*     int i;       /* argument to find first set bit in **/_ffsMsb:	movl	SP_ARG1(%esp),%edx		/* %edx = i */	bsrl	%edx,%eax	je	ffsNoBitSet 			/* zeros means no bit is set */	incl	%eax	ret	.align 4,0x90ffsNoBitSet:	xorl	%eax,%eax	ret#endif /* ! ffsALib_PORTABLE */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -