typedef unsigned long long BITSET64; struct board { BITSET64 Colours; BITSET64 Used; }
/* * IN - return 1 or 0 depending whether, bit, is in, set. */ static __inline__ int IN (BITSET64 set, int bit)
/* * INCL - set, bit, in, set. */ static __inline__ void INCL (BITSET64 *set, int bit)
/* * EXCL - unset, bit, in, set. */ static __inline__ void EXCL (BITSET64 *set, int bit)
BITSET64 set = 0;
static __inline__ int IN (BITSET64 set, int bit) { if (sizeof(BITSET64) > sizeof(unsigned int)) { unsigned int *p = (unsigned int *)&set; if (bit >= sizeof(unsigned int)*8) /* high unsigned int */ return (p[1] >> (bit-(sizeof(unsigned int)*8))) & 1; else /* low */ return (p[0] >> bit) & 1; } else return (set >> bit) & 1; }
/* * INCL - set, bit, in, set. */ static __inline__ void INCL (BITSET64 *set, int bit) { if (sizeof(BITSET64) > sizeof(unsigned int)) { unsigned int *p = (unsigned int *)set; if (bit >= sizeof(unsigned int)*8) /* high unsigned int */ p[1] |= 1 << (bit-(sizeof(unsigned int)*8)); else /* low */ p[0] |= 1 << bit; } else (*set) |= 1 << bit; }
/* * EXCL - unset, bit, in, set. */ static __inline__ void EXCL (BITSET64 *set, int bit) { if (sizeof(BITSET64) > sizeof(unsigned int)) { unsigned int *p = (unsigned int *)set; if (bit >= sizeof(unsigned int)*8) /* high unsigned int */ p[1] &= ~(1 << (bit-(sizeof(unsigned int)*8))); else /* low */ p[0] &= ~(1 << bit); } else (*set) &= ~(1 << bit); }
This document was produced using groff-1.22.