Index.h
Go to the documentation of this file.
1 // cwchessboard -- A C++ chessboard tool set
2 //
3 //! @file Index.h This file contains the declaration of class Index.
4 //
5 // Copyright (C) 2008, by
6 //
7 // Carlo Wood, Run on IRC <carlo@alinoe.com>
8 // RSA-1024 0x624ACAD5 1997-01-26 Sign & Encrypt
9 // Fingerprint16 = 32 EC A7 B6 AC DB 65 A6 F6 F6 55 DD 1C DC FF 61
10 //
11 // This program is free software: you can redistribute it and/or modify
12 // it under the terms of the GNU General Public License as published by
13 // the Free Software Foundation, either version 2 of the License, or
14 // (at your option) any later version.
15 //
16 // This program is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU General Public License for more details.
20 //
21 // You should have received a copy of the GNU General Public License
22 // along with this program. If not, see <http://www.gnu.org/licenses/>.
23 
24 #ifndef INDEX_H
25 #define INDEX_H
26 
27 #ifndef USE_PCH
28 #include <stdint.h>
29 #endif
30 
31 #define DEBUG_INDEX_INITIALIZATION_AND_RANGE_CHECK 0
32 
33 #if DEBUG_INDEX_INITIALIZATION_AND_RANGE_CHECK
34 #include <cassert>
35 #endif
36 
37 namespace cwchess {
38 
39 /** @brief The POD base type of class Index.
40 *
41  * The index of square a1 is \link cwchess::ia1 ia1 \endlink, and so on till \link cwchess::ih8 ih8 \endlink.
42 *
43  * @sa Index, index_pre_begin, index_begin, index_end
44 * /
45 struct IndexData {
46  uint8_t M_bits; //!< 00RRRCCC, where RRR is the row and CCC the column.
47 };
48 
49 uint8_t const col_mask = 0x07; //!< A mask for the bits used for the column in IndexData.
50 uint8_t const row_mask = 0x38; //!< A mask for the bits used for the row in IndexData.
51 
52 //! A constant representing the index to square a1.
53 IndexData const ia1 = { 0 };
54 //! A constant representing the index to square b1.
55 IndexData const ib1 = { 1 };
56 //! A constant representing the index to square c1.
57 IndexData const ic1 = { 2 };
58 //! A constant representing the index to square d1.
59 IndexData const id1 = { 3 };
60 //! A constant representing the index to square e1.
61 IndexData const ie1 = { 4 };
62 //! A constant representing the index to square f1.
63 IndexData const if1 = { 5 };
64 //! A constant representing the index to square g1.
65 IndexData const ig1 = { 6 };
66 //! A constant representing the index to square h1.
67 IndexData const ih1 = { 7 };
68 //! A constant representing the index to square a2.
69 IndexData const ia2 = { 8 };
70 //! A constant representing the index to square b2.
71 IndexData const ib2 = { 9 };
72 //! A constant representing the index to square c2.
73 IndexData const ic2 = { 10 };
74 //! A constant representing the index to square d2.
75 IndexData const id2 = { 11 };
76 //! A constant representing the index to square e2.
77 IndexData const ie2 = { 12 };
78 //! A constant representing the index to square f2.
79 IndexData const if2 = { 13 };
80 //! A constant representing the index to square g2.
81 IndexData const ig2 = { 14 };
82 //! A constant representing the index to square h2.
83 IndexData const ih2 = { 15 };
84 //! A constant representing the index to square a3.
85 IndexData const ia3 = { 16 };
86 //! A constant representing the index to square b3.
87 IndexData const ib3 = { 17 };
88 //! A constant representing the index to square c3.
89 IndexData const ic3 = { 18 };
90 //! A constant representing the index to square d3.
91 IndexData const id3 = { 19 };
92 //! A constant representing the index to square e3.
93 IndexData const ie3 = { 20 };
94 //! A constant representing the index to square f3.
95 IndexData const if3 = { 21 };
96 //! A constant representing the index to square g3.
97 IndexData const ig3 = { 22 };
98 //! A constant representing the index to square h3.
99 IndexData const ih3 = { 23 };
100 //! A constant representing the index to square a4.
101 IndexData const ia4 = { 24 };
102 //! A constant representing the index to square b4.
103 IndexData const ib4 = { 25 };
104 //! A constant representing the index to square c4.
105 IndexData const ic4 = { 26 };
106 //! A constant representing the index to square d4.
107 IndexData const id4 = { 27 };
108 //! A constant representing the index to square e4.
109 IndexData const ie4 = { 28 };
110 //! A constant representing the index to square f4.
111 IndexData const if4 = { 29 };
112 //! A constant representing the index to square g4.
113 IndexData const ig4 = { 30 };
114 //! A constant representing the index to square h4.
115 IndexData const ih4 = { 31 };
116 //! A constant representing the index to square a5.
117 IndexData const ia5 = { 32 };
118 //! A constant representing the index to square b5.
119 IndexData const ib5 = { 33 };
120 //! A constant representing the index to square c5.
121 IndexData const ic5 = { 34 };
122 //! A constant representing the index to square d5.
123 IndexData const id5 = { 35 };
124 //! A constant representing the index to square e5.
125 IndexData const ie5 = { 36 };
126 //! A constant representing the index to square f5.
127 IndexData const if5 = { 37 };
128 //! A constant representing the index to square g5.
129 IndexData const ig5 = { 38 };
130 //! A constant representing the index to square h5.
131 IndexData const ih5 = { 39 };
132 //! A constant representing the index to square a6.
133 IndexData const ia6 = { 40 };
134 //! A constant representing the index to square b6.
135 IndexData const ib6 = { 41 };
136 //! A constant representing the index to square c6.
137 IndexData const ic6 = { 42 };
138 //! A constant representing the index to square d6.
139 IndexData const id6 = { 43 };
140 //! A constant representing the index to square e6.
141 IndexData const ie6 = { 44 };
142 //! A constant representing the index to square f6.
143 IndexData const if6 = { 45 };
144 //! A constant representing the index to square g6.
145 IndexData const ig6 = { 46 };
146 //! A constant representing the index to square h6.
147 IndexData const ih6 = { 47 };
148 //! A constant representing the index to square a7.
149 IndexData const ia7 = { 48 };
150 //! A constant representing the index to square b7.
151 IndexData const ib7 = { 49 };
152 //! A constant representing the index to square c7.
153 IndexData const ic7 = { 50 };
154 //! A constant representing the index to square d7.
155 IndexData const id7 = { 51 };
156 //! A constant representing the index to square e7.
157 IndexData const ie7 = { 52 };
158 //! A constant representing the index to square f7.
159 IndexData const if7 = { 53 };
160 //! A constant representing the index to square g7.
161 IndexData const ig7 = { 54 };
162 //! A constant representing the index to square h7.
163 IndexData const ih7 = { 55 };
164 //! A constant representing the index to square a8.
165 IndexData const ia8 = { 56 };
166 //! A constant representing the index to square b8.
167 IndexData const ib8 = { 57 };
168 //! A constant representing the index to square c8.
169 IndexData const ic8 = { 58 };
170 //! A constant representing the index to square d8.
171 IndexData const id8 = { 59 };
172 //! A constant representing the index to square e8.
173 IndexData const ie8 = { 60 };
174 //! A constant representing the index to square f8.
175 IndexData const if8 = { 61 };
176 //! A constant representing the index to square g8.
177 IndexData const ig8 = { 62 };
178 //! A constant representing the index to square h8.
179 IndexData const ih8 = { 63 };
180 
181 //! A constant representing 'one before the start'.
182 IndexData const index_pre_begin = { 255 };
183 //! A constant representing the 'first' index.
184 IndexData const index_begin = { 0 };
185 //! A constant representing 'one past the end'.
186 IndexData const index_end = { 64 };
187 
188 // Compare constants (this should never be needed, but why not add it).
189 inline bool operator==(IndexData i1, IndexData i2) { return i1.M_bits == i2.M_bits; }
190 inline bool operator!=(IndexData i1, IndexData i2) { return i1.M_bits != i2.M_bits; }
191 
192 #if DEBUG_INDEX_INITIALIZATION_AND_RANGE_CHECK
193 uint64_t const index_initialization_magic = CW_MASK_T_CONST(1515151515151515151);
194 uint64_t const index_destruction_magic = CW_MASK_T_CONST(6666666666666666666);
195 #endif
196 
197 /** @brief The index of a chess square.
198 *
199  * This class represents the index to a square on the chessboard.
200  * It's value runs from 0 till 63, where 0 corresponds to a1 and 63 to h8.
201  * In addition there are two out of band values: index_pre_begin (255) and index_end (64).
202 *
203  * The three least significant bits represent the column, which runs from 0 to 7.
204  * The next three bits represent the row, which also runs from 0 to 7.
205 *
206  * Hence column 0 corresponds to file a, column 1 to file b etc,
207  * while row 0 corresponds to rank 1, row 1 to rank 2 etc.
208 *
209  * @sa IndexData, index_pre_begin, index_begin, index_end,
210 * /
211 class Index : protected IndexData {
212 #if DEBUG_INDEX_INITIALIZATION_AND_RANGE_CHECK
213  private:
214  uint64_t M_initialized;
215 #endif
216 
217  public:
218 #if DEBUG_INDEX_INITIALIZATION_AND_RANGE_CHECK
219  Index(void) : M_initialized(0) { }
220  ~Index() { M_initialized = index_destruction_magic; }
221 
222  bool is_initialized(void) const { return M_initialized == index_initialization_magic; }
223 #else
224  /** @name Constructors* /
225  //@{
226 
227  //! Construct an uninitialized Index object.
228  Index(void) { }
229 #endif
230 
231  //! Copy-constructor.
232  Index(Index const& index)
233  {
234 #if DEBUG_INDEX_INITIALIZATION_AND_RANGE_CHECK
235  assert(index.is_initialized());
236  M_initialized = index_initialization_magic;
237 #endif
238  M_bits = index.M_bits;
239  }
240 
241  //! Construct an Index object from a constant.
243  {
244 #if DEBUG_INDEX_INITIALIZATION_AND_RANGE_CHECK
245  assert(index.M_bits < 64 || index == index_end || index == index_pre_begin);
246  M_initialized = index_initialization_magic;
247 #endif
248  M_bits = index.M_bits;
249  }
250 
251  //! Construct an Index for column \a col and row \a row.
252  Index(int col, int row)
253  {
254 #if DEBUG_INDEX_INITIALIZATION_AND_RANGE_CHECK
255  assert(col >= 0 && col <= 7 && row >= 0 && row <= 7);
256  M_initialized = index_initialization_magic;
257 #endif
258  M_bits = ((uint8_t)row << 3) | (uint8_t)col;
259  }
260 
261  //@}
262 
263  /** @name Assignment operators* /
264  //@{
265 
266  Index& operator=(Index const& index)
267  {
268 #if DEBUG_INDEX_INITIALIZATION_AND_RANGE_CHECK
269  assert(index.is_initialized());
270  M_initialized = index_initialization_magic;
271 #endif
272  M_bits = index.M_bits;
273  return* this;
274  }
275 
276  Index& operator=(IndexData index)
277  {
278 #if DEBUG_INDEX_INITIALIZATION_AND_RANGE_CHECK
279  assert(index.M_bits < 64 || index == index_end || index == index_pre_begin);
280  M_initialized = index_initialization_magic;
281 #endif
282  M_bits = index.M_bits;
283  return* this;
284  }
285 
286  //@}
287 
288  /** @name Comparision operators* /
289  //@{
290 
291  friend bool operator==(Index const& i1, Index const& i2) { return i1.M_bits == i2.M_bits; }
292  friend bool operator==(Index const& i1, IndexData i2) { return i1.M_bits == i2.M_bits; }
293  friend bool operator==(IndexData i1, Index const& i2) { return i1.M_bits == i2.M_bits; }
294  friend bool operator!=(Index const& i1, Index const& i2) { return i1.M_bits != i2.M_bits; }
295  friend bool operator!=(Index const& i1, IndexData i2) { return i1.M_bits != i2.M_bits; }
296  friend bool operator!=(IndexData i1, Index const& i2) { return i1.M_bits != i2.M_bits; }
297 
298  friend bool operator<(Index const& index1, Index const& index2) { return index1.M_bits < index2.M_bits; }
299  friend bool operator<(Index const& index1, IndexData const& index2) { return index1.M_bits < index2.M_bits; }
300  friend bool operator<(IndexData const& index1, Index const& index2) { return index1.M_bits < index2.M_bits; }
301  friend bool operator<=(Index const& index1, Index const& index2) { return index1.M_bits <= index2.M_bits; }
302  friend bool operator<=(Index const& index1, IndexData const& index2) { return index1.M_bits <= index2.M_bits; }
303  friend bool operator<=(IndexData const& index1, Index const& index2) { return index1.M_bits <= index2.M_bits; }
304  friend bool operator>(Index const& index1, Index const& index2) { return index1.M_bits > index2.M_bits; }
305  friend bool operator>(Index const& index1, IndexData const& index2) { return index1.M_bits > index2.M_bits; }
306  friend bool operator>(IndexData const& index1, Index const& index2) { return index1.M_bits > index2.M_bits; }
307  friend bool operator>=(Index const& index1, Index const& index2) { return index1.M_bits >= index2.M_bits; }
308  friend bool operator>=(Index const& index1, IndexData const& index2) { return index1.M_bits >= index2.M_bits; }
309  friend bool operator>=(IndexData const& index1, Index const& index2) { return index1.M_bits >= index2.M_bits; }
310 
311  //@}
312 
313  /** @name Manipulators* /
314  //@{
315 
316  Index const& operator+=(int offset) { M_bits += offset; return* this; }
317  friend Index operator+(Index const& index, int offset) { Index result(index); return result += offset; }
318  friend Index operator+(int offset, Index const& index) { Index result(index); return result += offset; }
319  Index const& operator-=(int offset) { M_bits -= offset; return* this; }
320  friend Index operator-(Index const& index, int offset) { Index result(index); return result -= offset; }
321  friend Index operator-(int offset, Index const& index) { Index result(index); return result -= offset; }
322 
323  Index& operator++(void) { ++M_bits; return* this; }
324  Index operator++(int) { Index result(*this); operator++(); return result; }
325  Index& operator--(void) { ++M_bits; return* this; }
326  Index operator--(int) { Index result(*this); operator--(); return result; }
327 
328  //@}
329 
330  /** @name Accessors* /
331  //@{
332 
333  //! Returns the row.
334  int row(void) const { return M_bits >> 3; }
335 
336  //! Returns the column.
337  int col(void) const { return M_bits & 7; }
338 
339  //! Return the unlaying integral value.
340  uint8_t operator()(void) const { return M_bits; }
341 
342  //@}
343 
344  /** @name Special functions* /
345  //@{
346 
347  /*! @brief Advance the index to the next bit that is set in mask.
348  *
349  * Index may be 0xff, in which case it will be set to
350  * the first bit that is set in the mask (0...63) if any,
351  * or 64 if no bit is set.
352  *
353  * Otherwise Index must be in the range [0, 63],
354  * in which case a value is returned larger than the
355  * current value. If no more bits could be found, Index is
356  * set to 64.
357  *
358  * @param mask : The bitmask.
359  * /
360  void next_bit_in(uint64_t mask)
361  {
362 #if DEBUG_INDEX_INITIALIZATION_AND_RANGE_CHECK
363  assert(is_initialized());
364  assert(M_bits < 64 || M_bits == index_pre_begin.M_bits);
365 #endif
366  if (__builtin_expect(++M_bits == 64, 0))
367  return;
368  mask >>= M_bits;
369 #ifdef __x86_64
370  uint64_t indx = 64 - M_bits;
371  __asm__ __volatile__(
372  "bsfq %1, %0" // mask, indx
373  : "=&r" (indx)
374  : "r" (mask), "0" (indx)
375  : "cc"
376  );
377  M_bits += indx;
378 #else
379  union conversion {
380  uint64_t mask;
381  struct {
382  uint32_t low;
383  uint32_t high;
384  };
385  };
386  conversion tmp;
387  tmp.mask = mask;
388  uint32_t indx;
389  if (tmp.low)
390  {
391  __asm__ __volatile__(
392  "bsf %1, %0" // low, indx
393  : "=&r" (indx)
394  : "r" (tmp.low), "0" (indx)
395  : "cc"
396  );
397  M_bits += indx;
398  }
399  else
400  {
401  indx = 32 - M_bits;
402  __asm__ __volatile__(
403  "bsf %1, %0" // high, indx
404  : "=&r" (indx)
405  : "r" (tmp.high), "0" (indx)
406  : "cc"
407  );
408  M_bits += indx + 32;
409  }
410 #endif
411 #if DEBUG_INDEX_INITIALIZATION_AND_RANGE_CHECK
412  assert(M_bits <= 64);
413 #endif
414  }
415 
416  /*! @brief Retreat Index to the previous bit that is set.
417  *
418  * Index may be 64, in which case it will be set to the last
419  * bit that is set in the BitBoard (0...63) if any, or 0xff
420  * if no bit is set.
421  *
422  * Otherwise Index must be in the range <0, 63], in which
423  * case a value is returned smaller than the current value.
424  * If no more bits could be found, Index is set to 0xff.
425  *
426  * Normally a value of 0 should always return 0xff,
427  * but that is not the case. Don't call this function
428  * if the Index is 0.
429  *
430  * @param mask : The bitmask.
431  * /
432  void prev_bit_in(uint64_t mask)
433  {
434 #if DEBUG_INDEX_INITIALIZATION_AND_RANGE_CHECK
435  assert(is_initialized());
436  assert(M_bits > 0 && M_bits != index_pre_begin.M_bits);
437 #endif
438  M_bits = 64 - M_bits;
439  mask <<= M_bits;
440 #ifdef __x86_64
441  uint64_t indx = 0xff + M_bits;
442  __asm__ __volatile__(
443  "bsrq %1, %0" // mask, indx
444  : "=&r" (indx)
445  : "r" (mask), "0" (indx)
446  : "cc"
447  );
448  M_bits = indx - M_bits;
449 #else
450  union conversion {
451  uint64_t mask;
452  struct {
453  uint32_t low;
454  uint32_t high;
455  };
456  };
457  conversion tmp;
458  tmp.mask = mask;
459  uint32_t indx;
460  if (tmp.high)
461  {
462  __asm__ __volatile__(
463  "bsr %1, %0" // high, indx
464  : "=&r" (indx)
465  : "r" (tmp.high), "0" (indx)
466  : "cc"
467  );
468  M_bits = indx - M_bits + 32;
469  }
470  else
471  {
472  indx = 0xff + M_bits;
473  __asm__ __volatile__(
474  "bsr %1, %0" // low, indx
475  : "=&r" (indx)
476  : "r" (tmp.low), "0" (indx)
477  : "cc"
478  );
479  M_bits = indx - M_bits;
480  }
481 #endif
482 #if DEBUG_INDEX_INITIALIZATION_AND_RANGE_CHECK
483  assert(M_bits < 64 || M_bits == index_pre_begin.M_bits);
484 #endif
485  }
486 
487  //! Return TRUE if index is not index_pre_begin and also not 0.
488  bool may_call_prev_bit_in(void) const
489  {
490 #if DEBUG_INDEX_INITIALIZATION_AND_RANGE_CHECK
491  assert(is_initialized());
492 #endif
493  return (int8_t)M_bits > 0;
494  }
495 
496  //@}
497 
498 };
499 
500 } // namespace cwchess
501 
502 #endif // INDEX_H
IndexData const ie2
A constant representing the index to square e2.
Definition: Index.h:77
IndexData const index_begin
A constant representing the& #39;first&#39; index.
Definition: Index.h:184
A namespace for all chess related objects that are not related to the GUI.
Definition: Array.h:39
IndexData const ia7
A constant representing the index to square a7.
Definition: Index.h:149
IndexData const id3
A constant representing the index to square d3.
Definition: Index.h:91
IndexData const ig8
A constant representing the index to square g8.
Definition: Index.h:177
IndexData const ig3
A constant representing the index to square g3.
Definition: Index.h:97
IndexData const id4
A constant representing the index to square d4.
Definition: Index.h:107
IndexData const ih3
A constant representing the index to square h3.
Definition: Index.h:99
void prev_bit_in(uint64_t mask)
Retreat Index to the previous bit that is set.
Definition: Index.h:432
IndexData const ie3
A constant representing the index to square e3.
Definition: Index.h:93
Index(void)
Construct an uninitialized Index object.
Definition: Index.h:228
IndexData const ia3
A constant representing the index to square a3.
Definition: Index.h:85
IndexData const id8
A constant representing the index to square d8.
Definition: Index.h:171
IndexData const if1
A constant representing the index to square f1.
Definition: Index.h:63
IndexData const if3
A constant representing the index to square f3.
Definition: Index.h:95
IndexData const ic7
A constant representing the index to square c7.
Definition: Index.h:153
IndexData const ig1
A constant representing the index to square g1.
Definition: Index.h:65
uint8_t const row_mask
A mask for the bits used for the row in IndexData.
Definition: Index.h:50
IndexData const ia4
A constant representing the index to square a4.
Definition: Index.h:101
IndexData const if4
A constant representing the index to square f4.
Definition: Index.h:111
IndexData const ia1
A constant representing the index to square a1.
Definition: Index.h:53
IndexData const ih1
A constant representing the index to square h1.
Definition: Index.h:67
IndexData const ic3
A constant representing the index to square c3.
Definition: Index.h:89
IndexData const ib5
A constant representing the index to square b5.
Definition: Index.h:119
IndexData const ih4
A constant representing the index to square h4.
Definition: Index.h:115
IndexData const ib1
A constant representing the index to square b1.
Definition: Index.h:55
void next_bit_in(uint64_t mask)
Advance the index to the next bit that is set in mask.
Definition: Index.h:360
IndexData const ih5
A constant representing the index to square h5.
Definition: Index.h:131
IndexData const if2
A constant representing the index to square f2.
Definition: Index.h:79
Index(IndexData index)
Construct an Index object from a constant.
Definition: Index.h:242
IndexData const ih8
A constant representing the index to square h8.
Definition: Index.h:179
IndexData const if8
A constant representing the index to square f8.
Definition: Index.h:175
IndexData const ie4
A constant representing the index to square e4.
Definition: Index.h:109
IndexData const ia8
A constant representing the index to square a8.
Definition: Index.h:165
The POD base type of class Index.
Definition: Index.h:45
IndexData const ib8
A constant representing the index to square b8.
Definition: Index.h:167
IndexData const ic1
A constant representing the index to square c1.
Definition: Index.h:57
Index(Index const& index)
Copy-constructor.
Definition: Index.h:232
IndexData const ib3
A constant representing the index to square b3.
Definition: Index.h:87
IndexData const id1
A constant representing the index to square d1.
Definition: Index.h:59
The index of a chess square.
Definition: Index.h:211
uint8_t operator()(void) const
Return the unlaying integral value.
Definition: Index.h:340
IndexData const ih2
A constant representing the index to square h2.
Definition: Index.h:83
IndexData const ie5
A constant representing the index to square e5.
Definition: Index.h:125
IndexData const ih7
A constant representing the index to square h7.
Definition: Index.h:163
int col(void) const
Returns the column.
Definition: Index.h:337
IndexData const ia5
A constant representing the index to square a5.
Definition: Index.h:117
IndexData const ig5
A constant representing the index to square g5.
Definition: Index.h:129
IndexData const ic6
A constant representing the index to square c6.
Definition: Index.h:137
IndexData const ig7
A constant representing the index to square g7.
Definition: Index.h:161
IndexData const ih6
A constant representing the index to square h6.
Definition: Index.h:147
IndexData const ig2
A constant representing the index to square g2.
Definition: Index.h:81
IndexData const id7
A constant representing the index to square d7.
Definition: Index.h:155
IndexData const ic4
A constant representing the index to square c4.
Definition: Index.h:105
IndexData const ib2
A constant representing the index to square b2.
Definition: Index.h:71
IndexData const ie6
A constant representing the index to square e6.
Definition: Index.h:141
IndexData const ie7
A constant representing the index to square e7.
Definition: Index.h:157
int row(void) const
Returns the row.
Definition: Index.h:334
IndexData const ic5
A constant representing the index to square c5.
Definition: Index.h:121
IndexData const ia2
A constant representing the index to square a2.
Definition: Index.h:69
IndexData const id2
A constant representing the index to square d2.
Definition: Index.h:75
IndexData const id6
A constant representing the index to square d6.
Definition: Index.h:139
IndexData const ic2
A constant representing the index to square c2.
Definition: Index.h:73
IndexData const ig4
A constant representing the index to square g4.
Definition: Index.h:113
bool may_call_prev_bit_in(void) const
Return TRUE if index is not index_pre_begin and also not 0.
Definition: Index.h:488
IndexData const ic8
A constant representing the index to square c8.
Definition: Index.h:169
IndexData const ig6
A constant representing the index to square g6.
Definition: Index.h:145
IndexData const if5
A constant representing the index to square f5.
Definition: Index.h:127
IndexData const id5
A constant representing the index to square d5.
Definition: Index.h:123
IndexData const index_pre_begin
A constant representing& #39;one before the start&#39;.
Definition: Index.h:182
uint8_t M_bits
00RRRCCC, where RRR is the row and CCC the column.
Definition: Index.h:46
IndexData const ib4
A constant representing the index to square b4.
Definition: Index.h:103
IndexData const index_end
A constant representing& #39;one past the end&#39;.
Definition: Index.h:186
IndexData const ie8
A constant representing the index to square e8.
Definition: Index.h:173
IndexData const if6
A constant representing the index to square f6.
Definition: Index.h:143
IndexData const if7
A constant representing the index to square f7.
Definition: Index.h:159
Index(int col, int row)
Construct an Index for column col and row row.
Definition: Index.h:252
uint8_t const col_mask
A mask for the bits used for the column in IndexData.
Definition: Index.h:49
IndexData const ib6
A constant representing the index to square b6.
Definition: Index.h:135
IndexData const ie1
A constant representing the index to square e1.
Definition: Index.h:61
IndexData const ia6
A constant representing the index to square a6.
Definition: Index.h:133
IndexData const ib7
A constant representing the index to square b7.
Definition: Index.h:151

Copyright © 2006 - 2010 Carlo Wood.  All rights reserved.