pentago/base/superscore.h
// Non-SSE version of rmax
Non-SSE version of rmax
Non - SSE version of rmax
static inline super_t rmax(const super_t f) {
  const uint64_t each0 = 0x1111111111111111,
                 each1 = 0x000f000f000f000f,
                 each2 = 0x000000000000ffff;
  #define SHIFT_MASK(x,shift,mask) ((shift>0?x<<(shift):x>>-(shift))&(mask))
  #define FIRST_THREE(x) \
    (  SHIFT_MASK(x,  1,~each0)    |SHIFT_MASK(x, -3,each0)       /* Rotate quadrant 0 left */ \
     | SHIFT_MASK(x, -1,~each0>>1) |SHIFT_MASK(x,  3,each0<<3)    /* Rotate quadrant 0 right */ \
     | SHIFT_MASK(x,  4,~each1)    |SHIFT_MASK(x,-12,each1)       /* Rotate quadrant 1 left */ \
     | SHIFT_MASK(x, -4,~each1>>4) |SHIFT_MASK(x, 12,each1<<12)   /* Rotate quadrant 1 right */ \
     | SHIFT_MASK(x, 16,~each2)    |SHIFT_MASK(x,-48,each2)       /* Rotate quadrant 2 left */ \
     | SHIFT_MASK(x,-16,~each2>>16)|SHIFT_MASK(x, 48,each2<<48))  /* Rotate quadrant 2 right */
  return super_t(FIRST_THREE(f.a)|f.d|f.b,
                 FIRST_THREE(f.b)|f.a|f.c,
                 FIRST_THREE(f.c)|f.b|f.d,
                 FIRST_THREE(f.d)|f.c|f.a);
}
static inline super_t rmax ( const super_t f ) { const uint64_t each0 = 0x1111111111111111 , each1 = 0x000f000f000f000f , each2 = 0x000000000000ffff ; #define SHIFT_MASK ( x , shift , mask )  ((shift>0?x<<(shift):x>>-(shift))&(mask)) #define FIRST_THREE ( x )  \
    (  SHIFT_MASK(x,  1,~each0)    |SHIFT_MASK(x, -3,each0)       /* Rotate quadrant 0 left */ \
     | SHIFT_MASK(x, -1,~each0>>1) |SHIFT_MASK(x,  3,each0<<3)    /* Rotate quadrant 0 right */ \
     | SHIFT_MASK(x,  4,~each1)    |SHIFT_MASK(x,-12,each1)       /* Rotate quadrant 1 left */ \
     | SHIFT_MASK(x, -4,~each1>>4) |SHIFT_MASK(x, 12,each1<<12)   /* Rotate quadrant 1 right */ \
     | SHIFT_MASK(x, 16,~each2)    |SHIFT_MASK(x,-48,each2)       /* Rotate quadrant 2 left */ \
     | SHIFT_MASK(x,-16,~each2>>16)|SHIFT_MASK(x, 48,each2<<48))  /* Rotate quadrant 2 right */ return super_t ( FIRST_THREE ( f . a ) | f . d | f . b , FIRST_THREE ( f . b ) | f . a | f . c , FIRST_THREE ( f . c ) | f . b | f . d , FIRST_THREE ( f . d ) | f . c | f . a ) ; }
Non-SSE version of rmax
Non - SSE version of rmax