From: ams AT ludd DOT luth DOT se (Martin Str|mberg) Newsgroups: comp.os.msdos.djgpp Subject: Re: LastBit() Date: 18 Jul 1999 11:03:38 GMT Organization: University of Lulea, Sweden Lines: 32 Message-ID: <7mscaa$k7q$2@news.luth.se> References: <7mrg4k$20f$1 AT reader3 DOT wxs DOT nl> NNTP-Posting-Host: queeg.ludd.luth.se X-Newsreader: TIN [UNIX 1.3 950824BETA PL0] To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Bas Hamstra (bas DOT hamstra AT wxs DOT nl) wrote: : Hello again! : : I am still very happy with the profiler patch, it really helped. Now I : have a very small problem. : : In my chess program I need to find the last bit in a unsigned long long : (or sometimes a unsigned long). : : Note: I just need the *index* of that bit. Now I know there is an : assembler instruction for a 32 bit LastOne(). I used inline assembly in : Borland 3.1 for that instruction and it worked. : : Two questions: : : a) How do I use inline assembler in DJ? It's different from BC... : b) When LastOne works for a 32 bit number, how to for a ull ? : : It's time critical. Actually a PopCount() (count no bits) would be handy : too but I think there's no assembly equivalent. a) Look at and read relevant links. "info gcc" is useful too. b) Not sure (am not an assembly guy). But how about checking the correct first half first and not finding anything, check the second half (all in assebler)? Right, MartinS