@@ -132,28 +132,8 @@ template<> const SFMap& EndgameFunctions::get<SF>() const { return maps.second;
132132// // Functions
133133// //
134134
135- // / MaterialInfoTable c'tor and d'tor, called once by each thread
136-
137- MaterialInfoTable::MaterialInfoTable () {
138-
139- entries = new MaterialInfo[MaterialTableSize];
140- funcs = new EndgameFunctions ();
141-
142- if (!entries || !funcs)
143- {
144- cerr << " Failed to allocate " << MaterialTableSize * sizeof (MaterialInfo)
145- << " bytes for material hash table." << endl;
146- exit (EXIT_FAILURE);
147- }
148- memset (entries, 0 , MaterialTableSize * sizeof (MaterialInfo));
149- }
150-
151- MaterialInfoTable::~MaterialInfoTable () {
152-
153- delete funcs;
154- delete [] entries;
155- }
156-
135+ MaterialInfoTable::MaterialInfoTable () { funcs = new EndgameFunctions (); }
136+ MaterialInfoTable::~MaterialInfoTable () { delete funcs; }
157137
158138// / MaterialInfoTable::game_phase() calculates the phase given the current
159139// / position. Because the phase is strictly a function of the material, it
@@ -181,8 +161,7 @@ Phase MaterialInfoTable::game_phase(const Position& pos) {
181161MaterialInfo* MaterialInfoTable::get_material_info (const Position& pos) {
182162
183163 Key key = pos.get_material_key ();
184- unsigned index = unsigned (key & (MaterialTableSize - 1 ));
185- MaterialInfo* mi = entries + index;
164+ MaterialInfo* mi = find (key);
186165
187166 // If mi->key matches the position's material hash key, it means that we
188167 // have analysed this material configuration before, and we can simply
0 commit comments