WSJT-X/igray.c
Joe Taylor a8450874bc Removed ran1 and gasdev; replaced igray, sort, and indexx.
git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/trunk@34 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
2005-12-29 20:12:45 +00:00

19 lines
244 B
C

int igray_(int *n0, int *idir)
{
int n;
unsigned long sh;
unsigned long nn;
n=*n0;
if(*idir>0) return (n ^ (n >> 1));
sh = 1;
nn = (n >> sh);
while (nn > 0) {
n ^= nn;
sh <<= 1;
nn = (n >> sh);
}
return (n);
}