From 04e2e8d221523c69a7be9bd0308be0cc0b9dcafc Mon Sep 17 00:00:00 2001 From: nitsuja Date: Sun, 1 Nov 2009 22:24:44 +0000 Subject: [PATCH] fix for texcache scan occasionally doing unnecessary iterations --- desmume/src/texcache.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/desmume/src/texcache.cpp b/desmume/src/texcache.cpp index 46080e245..a87d50374 100644 --- a/desmume/src/texcache.cpp +++ b/desmume/src/texcache.cpp @@ -279,9 +279,12 @@ public: //TODO - as a special optimization, keep the last item returned and check it first - for(TTexCacheItemMultimap::iterator it(index.find(format)); it != index.end(); ++it) + for(std::pair + iters = index.equal_range(format); + iters.first != iters.second; + ++iters.first) { - TexCacheItem* curr = it->second; + TexCacheItem* curr = iters.first->second; //conditions where we reject matches: //when the teximage or texpal params dont match