> I got this code of the net ... Looks like you got about what you paid for it. I don't know who this Eric Smith guy is that claims to have written it, but I would stay away from anything else that has his name on it. > ringadv macro ptr,base,size > local pow2,aligned,bit,val > pow2 SET !(size&(size-1)) > aligned SET pow2&&((base&(size-1))==0) > > if aligned > val set size > bit set 0 > while val>1 > bit set bit+1 > val set val>>1 > endw > endif > Good thing it's so well commented! Indeed. An interesting example of portability (or the lack thereof.) In an effort to make the code portable/usable on a wide variety of PICs (circa 1997) with assorted memory layouts, it has become all but incomprehensible to anyone who couldn't have written their own code in the first place. Obscure and powerful conditional assembly; Oh My! Add five years an another generation or two of PICs and it loses much of it's utility. :-( I'd blame this on assembler, except I see the same sort of thing ALL THE TIME with C programs from a certain era. Lovely incomprehensible make files and preprocessor directives so that the code will compile under 4.2BSD, AT&T SysV, SunOS 3.2, HP SysV, MSDOS using turbo-C, MSDOS using MS C, etc. Try to figure out what needs to be done in a modern Posix/windows environment, and you're lost unless you're not only a unix wizard, but also a wizard in at least one variety of obsolete unix :-( BillW -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.