src/lib/pokerstove/util/lastbit.h
// this one is slow on XP 32
this one is slow on XP 32
this one is slow on XP 32
inline int lastbit64(uint64_t v)
{
    int r;  
    static const int
        Mod67BitPosition[] =  
        {
            0,  0,  1,  39, 2,  15, 40, 23, 3,  12, 16, 59, 41, 19, 24, 54, 4,
            0,  13, 10, 17, 62, 60, 28, 42, 30, 20, 51, 25, 44, 55, 47, 5,  32,
            0,  38, 14, 22, 11, 58, 18, 53, 63, 9,  61, 27, 29, 50, 43, 46, 31,
            37, 21, 57, 52, 8,  26, 49, 45, 36, 56, 7,  48, 35, 6,  34, 33,
        };
    r = Mod67BitPosition[(-v & v) % 67];
    return r;
}
inline int lastbit64 ( uint64_t v ) { int r ; static const int Mod67BitPosition [ ] = { 0 , 0 , 1 , 39 , 2 , 15 , 40 , 23 , 3 , 12 , 16 , 59 , 41 , 19 , 24 , 54 , 4 , 0 , 13 , 10 , 17 , 62 , 60 , 28 , 42 , 30 , 20 , 51 , 25 , 44 , 55 , 47 , 5 , 32 , 0 , 38 , 14 , 22 , 11 , 58 , 18 , 53 , 63 , 9 , 61 , 27 , 29 , 50 , 43 , 46 , 31 , 37 , 21 , 57 , 52 , 8 , 26 , 49 , 45 , 36 , 56 , 7 , 48 , 35 , 6 , 34 , 33 , } ; r = Mod67BitPosition [ ( - v & v ) % 67 ] ; return r ; }
this one is slow on XP 32
this one is slow on XP 32
// put the result in r // map a bit value mod 37 to its position // cout << (-v&v)%37 << " " << lastbit(v) << endl; //  cout << (-v&v)%67 << " " << lastbit(v) << " " << r << endl; //  if (lastbit(v) != r) //  cout << "fuck\n";