-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtransform.cpp
44 lines (29 loc) · 834 Bytes
/
transform.cpp
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
44
#include "core.h"
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <chrono>
#include <iostream>
using namespace std;
int main() {
FILE* file = fopen("gol1024.pbm", "rb");
if (file == nullptr) {
perror("Failed to open file");
return 1;
}
size_t n;
word_t** hvs = bhv::load_pbm(file, &n);
assert(n == 1024);
fclose(file);
auto t0 = chrono::high_resolution_clock::now();
for (size_t i = 0; i < n; ++i)
bhv::rehash_into(hvs[i], hvs[i]);
auto t1 = chrono::high_resolution_clock::now();
cout << chrono::duration_cast<chrono::nanoseconds>(t1 - t0).count() << endl;
FILE* ofile = fopen("hash_gol1024.pbm", "wb");
bhv::save_pbm(ofile, hvs, n);
fclose(ofile);
for (size_t i = 0; i < n; ++i)
free(hvs[i]);
return 0;
}