/* Bit scan forward - 64 bit version
 * (c) 2004, Mikko Nummelin */
.globl _my_bsf
_my_bsf:
	pushl	%ebp		/* Stores frame pointer to stack */
	movl	%esp, %ebp	/* Sets frame pointer to stack pointer */
	movl	8(%ebp), %edx	/* Loads ls 32bits into edx */
	bsf	%edx, %eax	/* Tests for ls set bit */
	jne	_exit	
	movl	12(%ebp), %edx	/* Loads ms 32bits into edx */
	bsf	%edx, %eax	/* Tests for ls set bit */
	je	_all_zero	/* The whole 64bit word is zero */
	addl	$32, %eax	/* Adds 32 to return value */
	jmp	_exit	
_all_zero:
	movl	$64, %eax	/* Returns 64 to signal zero arg */
_exit:
	popl	%ebp		/* Restores frame pointer */
	ret			/* OK */
