Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- final long hashMask = 0x7fffffffffffffffl;
- long nTableElements = 11671106;
- public void put(long hash, int score, int depth) {
- // mask to make sure it is a positive value
- hash &= hashMask;
- // make sure no other thread fiddles with it
- int lockIndex = (int)(hash & 255);
- locks[lockIndex].acquireUninterruptibly();
- int arrayIndex = (int)(hash % nTableElements);
- hashes[arrayIndex] = hash;
- scores[arrayIndex] = score;
- depths[arrayIndex] = depth;
- locks[lockIndex].release();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement