30 uint64_t
Rank(
int *items,
int k)
const {
return RankHelper(items, k, N, 0); }
31 void Unrank(uint64_t hash,
int *items,
int k)
const {
return UnrankHelper(hash, items, k, N, N); }
33 uint64_t
RankHelper(
int *board,
int count,
int spaces,
int offset)
const
37 if (board[0]-offset == 0)
38 return RankHelper(&board[1], count-1, spaces-1, offset+1);
40 return res+
RankHelper(board, count, spaces-1, offset+1);
43 void UnrankHelper(uint64_t rank,
int *board,
int count,
int spaces,
int total)
const
51 board[0] = total-spaces;