/*****************************************************************************/ /* */ /* LEFT-MOST BIT DETECTION */ /* 01/12/07 (dkc) */ /* */ /*****************************************************************************/ unsigned int lmbd(unsigned int mode, unsigned int a) { unsigned int i,mask,count; if (mode==0) a=~a; if (a==0) return(32); count=0; mask=0x80000000; for (i=0; i<32; i++) { if ((a&mask)!=0) break; count+=1; mask>>=1; } return(count); }