File: pathEncoding.cc

package info (click to toggle)
libosl 0.5.0-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 273,976 kB
  • sloc: cpp: 129,625; ansic: 7,145; ruby: 1,290; makefile: 558; perl: 413; sh: 35
file content (43 lines) | stat: -rw-r--r-- 956 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/* pathEncoding.cc
 */
#include "osl/misc/random.h"
#include "osl/pathEncoding.h"
#include <iostream>

osl::PathEncodingTable::
PathEncodingTable()
{
  for (size_t i=0; i<MaxEncodingLength; ++i)
  {
    for (size_t j=0; j<Square::SIZE; ++j)
    {
      for (int k=0; k<PTYPE_SIZE; ++k)
      {
	const unsigned long long h = random();
	const unsigned int l = random();
	assert(l);
	assert(h << 32);
	// 手番を表現するため下位1bitをあけておく
	values[i][j][k] = (h << 32) + (l & (~1u));
      }
    }
  }
}

osl::PathEncodingTable::
~PathEncodingTable()
{
}

#if (!defined MINIMAL ) || (defined DFPNSTATONE)
std::ostream& osl::operator<<(std::ostream& os, const osl::PathEncoding& path)
{
  os << std::hex << path.getPath() << std::dec << " " << path.getDepth();
  return os;
}
#endif
/* ------------------------------------------------------------------------- */
// ;;; Local Variables:
// ;;; mode:c++
// ;;; c-basic-offset:2
// ;;; End: