opposite direction :-(
Fixed our own log2 (it hadn't any chance to work before).
#define NONRET
#endif
-
-#ifdef linux
-#define HAVE_FFS
-#endif
/* Binary log */
-#ifdef HAVE_FFS
-#define log2(x) (ffs(x) - 1)
-#else
int log2(ulg);
-#endif
/* obj.c */
#include "lib.h"
+#undef log2
+
int
-ffs(ulg x)
+log2(ulg x)
{
ulg l;
return 0;
l = 0;
- if (x & 0xffff0000) l += 16;
- if (x & 0xff00ff00) l += 8;
- if (x & 0xf0f0f0f0) l += 4;
- if (x & 0xcccccccc) l += 2;
+ if (x & 0xffff0000) { l += 16; x &= 0xffff0000; }
+ if (x & 0xff00ff00) { l += 8; x &= 0xff00ff00; }
+ if (x & 0xf0f0f0f0) { l += 4; x &= 0xf0f0f0f0; }
+ if (x & 0xcccccccc) { l += 2; x &= 0xcccccccc; }
if (x & 0xaaaaaaaa) l++;
return l;
}