Skip to content

Commit

Permalink
Remove lookuph and friends.
Browse files Browse the repository at this point in the history
  • Loading branch information
rokicki committed Aug 21, 2023
1 parent 11c2d73 commit 313a610
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 20 deletions.
11 changes: 0 additions & 11 deletions src/cpp/prunetable.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,24 +87,13 @@ struct prunetable {
prunetable& operator=(prunetable &&) noexcept = delete ;
void filltable(const puzdef &pd, int d) ;
void checkextend(const puzdef &pd, int ignorelookups=0) ;
int lookuph(ull h) const { // deprecate this
h = indexhash(h) ;
int v = 3 & (mem[h >> 5] >> ((h & 31) * 2)) ;
if (v == 3)
return (mem[(h >> 5) & ~7] & 15) - 1 ;
else
return 2 - v + baseval ;
}
int lookuphindexed(ull h) const {
int v = 3 & (mem[h >> 5] >> ((h & 31) * 2)) ;
if (v == 3)
return (mem[(h >> 5) & ~7] & 15) - 1 ;
else
return 2 - v + baseval ;
}
void prefetch(ull h) const { // deprecate this
__builtin_prefetch(mem+(indexhash(h) >> 5)) ;
}
ull prefetchindexed(ull h) const {
__builtin_prefetch(mem+(h >> 5)) ;
return h ;
Expand Down
18 changes: 9 additions & 9 deletions src/cpp/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,22 +78,22 @@ void timingtest(puzdef &pd) {
int rmv = myrand(pd.moves.size()) ;
pd.mul(p1, pd.moves[rmv].pos, p2) ;
slowmodm2(pd, p2, p1) ;
sum += pt.lookuph(tgo[i&mask]) ;
tgo[i&mask] = fasthash(pd.totsize, p1) ;
pt.prefetch(tgo[i&mask]) ;
sum += pt.lookuphindexed(tgo[i&mask]) ;
tgo[i&mask] = pt.indexhash(pd.totsize, p1) ;
pt.prefetchindexed(tgo[i&mask]) ;
}
} else {
for (int i=0; i<cnt; i += 2) {
int rmv = myrand(pd.moves.size()) ;
pd.mul(p1, pd.moves[rmv].pos, p2) ;
sum += pt.lookuph(tgo[i&mask]) ;
tgo[i&mask] = fasthash(pd.totsize, p2) ;
pt.prefetch(tgo[i&mask]) ;
sum += pt.lookuphindexed(tgo[i&mask]) ;
tgo[i&mask] = pt.indexhash(pd.totsize, p2) ;
pt.prefetchindexed(tgo[i&mask]) ;
rmv = myrand(pd.moves.size()) ;
pd.mul(p2, pd.moves[rmv].pos, p1) ;
sum += pt.lookuph(tgo[1+(i&mask)]) ;
tgo[1+(i&mask)] = fasthash(pd.totsize, p1) ;
pt.prefetch(tgo[1+(i&mask)]) ;
sum += pt.lookuphindexed(tgo[1+(i&mask)]) ;
tgo[1+(i&mask)] = pt.indexhash(pd.totsize, p1) ;
pt.prefetchindexed(tgo[1+(i&mask)]) ;
}
}
tim = duration() ;
Expand Down

0 comments on commit 313a610

Please sign in to comment.