1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-29 16:23:09 +00:00

Material: micro optimize map reading

Do only one map walk per read instead of two.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba 2008-10-29 07:52:20 +01:00
parent bd3ec6af15
commit 79513e3a43

View file

@ -70,9 +70,10 @@ namespace {
EndgameEvaluationFunction* f = NULL;
lock_grab(&EEFmapLock);
if (EEFmap.find(key) != EEFmap.end())
f = EEFmap[key];
std::map<Key, EndgameEvaluationFunction*>::iterator it(EEFmap.find(key));
if (it != EEFmap.end())
f = it->second;
lock_release(&EEFmapLock);
return f;
@ -84,8 +85,9 @@ namespace {
lock_grab(&ESFmapLock);
if (ESFmap.find(key) != ESFmap.end())
si = ESFmap[key];
std::map<Key, ScalingInfo>::iterator it(ESFmap.find(key));
if (it != ESFmap.end())
si = it->second;
lock_release(&ESFmapLock);
return si;