Write a function that returns zero if INDF is a power of two, else returns non-zero. For example, here's one of the most inefficient ones I can think of: clrw loop: btfsc indf,0 ;count the 1's addlw 1 clrc rrf indf,f ;move the next bit to bit 0 skpz ;If more 1's, loop more goto loop xorlw 1 ;If only one 1, then we found a power ;of 2, so return a zero. return Hint: The most efficient one I can think of off the top of my head only takes 6 cycles (counting the return). I'm quite certain a 5 cycle version lurks in the midst. Scott -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu