; d0 - value

	xdef	_BitSize

_BitSize	movem.l	d1-d2,-(a7)
	moveq	#0,d1
	moveq	#31,d2	; number of bit
.looph	btst.l	d2,d0
	bne.s	.loopl
	dbra	d2,.looph
.loopl	btst.l	d1,d0	; d2 contains top
	bne.s	.end
	addq	#1,d1
	cmp.l	d2,d1
	blt.s	.loopl
	moveq	#0,d0
	bra.s	.finish
.end	addq	#1,d2
	sub.l	d1,d2
	move.l	d2,d0
.finish	movem.l	(a7)+,d1-d2
	rts
