Fathom
Fathom copied to clipboard
does not compile on non-x86 platforms (e.g. arm)
/tmp/ccE5S8Kh.s: Assembler messages:
/tmp/ccE5S8Kh.s:4818: Error: bad instruction bsfq r2,r3' /tmp/ccE5S8Kh.s:7391: Error: bad instruction bsfq r2,ip'
/tmp/ccE5S8Kh.s:7423: Error: bad instruction bsfq r0,r3' /tmp/ccE5S8Kh.s:7503: Error: bad instruction bsfq [sp,#104],r8'
/tmp/ccE5S8Kh.s:8201: Error: bad instruction `bsfq r4,r3'
and so on
Index: tbprobe.c
--- tbprobe.c (revision 3989) +++ tbprobe.c (working copy) @@ -30,7 +30,6 @@ #include "tbprobe.h"
#ifdef GNUC -#include <x86intrin.h> #endif
#define WHITE_KING (TB_WPAWN + 5) @@ -127,12 +126,9 @@ #ifdef TB_CUSTOM_LSB #define lsb(b) TB_CUSTOM_LSB(b) #else -static inline unsigned lsb(uint64_t b) -{
- size_t idx;
- asm("bsfq %1, %0": "=r"(idx): "rm"(b));
- return idx; -} +// from http://cb2pgn.googlecode.com/svn/trunk/jni/mstl/m_bit_functions.ipp +inline unsigned ctz(unsigned long long x) { return __builtin_ctzll(x); } +inline unsigned lsb(uint64_t x) { return ctz(x); } #endif #define square(r, f) (8 * (r) + (f))