renames
This commit is contained in:
parent
0ce11d082c
commit
f8e9232a64
20 changed files with 4 additions and 4 deletions
32
benchmarks/microbench/src/queen/queen.c
Normal file
32
benchmarks/microbench/src/queen/queen.c
Normal file
|
@ -0,0 +1,32 @@
|
|||
#include <benchmark.h>
|
||||
|
||||
static unsigned int FULL;
|
||||
|
||||
static unsigned int dfs(unsigned int row, unsigned int ld, unsigned int rd) {
|
||||
if (row == FULL) {
|
||||
return 1;
|
||||
} else {
|
||||
unsigned int pos = FULL & (~(row | ld | rd)), ans = 0;
|
||||
while (pos) {
|
||||
unsigned int p = (pos & (~pos + 1));
|
||||
pos -= p;
|
||||
ans += dfs(row | p, (ld | p) << 1, (rd | p) >> 1);
|
||||
}
|
||||
return ans;
|
||||
}
|
||||
}
|
||||
|
||||
static unsigned int ans;
|
||||
|
||||
void bench_queen_prepare() {
|
||||
ans = 0;
|
||||
FULL = (1 << setting->size) - 1;
|
||||
}
|
||||
|
||||
void bench_queen_run() {
|
||||
ans = dfs(0, 0, 0);
|
||||
}
|
||||
|
||||
int bench_queen_validate() {
|
||||
return ans == setting->checksum;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue