empty.h
Go to the documentation of this file.
1 
11 #ifndef EDAX_EMPTY_H
12 #define EDAX_EMPTY_H
13 
15 typedef struct SquareList {
16  unsigned long long b;
17  int x;
18  int quadrant;
19  struct SquareList *previous;
20  struct SquareList *next;
21 } SquareList;
22 
28 static inline void empty_remove(SquareList *empty)
29 {
30  empty->previous->next = empty->next;
31  empty->next->previous = empty->previous;
32 }
33 
39 static inline void empty_restore(SquareList *empty)
40 {
41  empty->previous->next = empty;
42  empty->next->previous = empty;
43 }
44 
46 #define foreach_empty(empty, list)\
47  for ((empty) = (list)->next; (empty)->next; (empty) = (empty)->next)
48 
50 #define foreach_even_empty(empty, list, parity)\
51  for ((empty) = (list)->next; (empty)->next; (empty) = (empty)->next) if ((parity & empty->quadrant) == 0)
52 
54 #define foreach_odd_empty(empty, list, parity)\
55  for ((empty) = (list)->next; (empty)->next; (empty) = (empty)->next) if (parity & empty->quadrant)
56 
57 #endif
58 
struct SquareList SquareList
int quadrant
Definition: empty.h:18
struct SquareList * previous
Definition: empty.h:19
static void empty_remove(SquareList *empty)
remove an empty square from the list.
Definition: empty.h:28
static void empty_restore(SquareList *empty)
restore the list of empty squares
Definition: empty.h:39
unsigned long long b
Definition: empty.h:16
int x
Definition: empty.h:17
struct SquareList * next
Definition: empty.h:20
Definition: empty.h:15