From: "Ernie Deel" Subject: Re: Bits in byte Date: 30 Sep 1999 00:00:00 GMT Message-ID: <7svnb2$frs16@forums.borland.com> References: <7s5ben$5nf2@forums.borland.com> <37e674e1.5980290@forums.borland.com> <37E6E9E9.C5888BAF@xoommail.com> <37E6F13A.2EEFD176@xoommail.com> <7sjvb9$9dd2@forums.borland.com> <7snfig$63311@forums.borland.com> <7snlaq$a1p1@forums.borland.com> <7so0k7$d4m1@forums.borland.com> <7sujq8$6sg7@forums.borland.com> X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211 Organization: Another Netscape Collabra Server User X-MSMail-Priority: Normal Newsgroups: borland.public.delphi.basm I realize I'm late and I haven't studied all the entrants but for what it's worth, here's mine. function CountBits(const Value: Integer): Integer; asm xor ecx,ecx xor edx,edx @top: bsf ecx,eax jz @done inc ecx inc edx shr eax,cl jmp @top @done: mov eax,edx end; -- Ernie Deel, EFD Systems ------------------------------------------------- Gravity ... not just a good idea, it's the law.