Index: /trunk/lib/generic_cache_tsar/include/generic_cache.h
===================================================================
--- /trunk/lib/generic_cache_tsar/include/generic_cache.h	(revision 302)
+++ /trunk/lib/generic_cache_tsar/include/generic_cache.h	(revision 303)
@@ -600,8 +600,12 @@
                             bool*     cleanup )
     {
+        size_t _set = m_y[ad];
+
+        *found = false;
+
         // Search first empty slot 
-        for ( size_t _way = 0 ; _way < m_ways && !found ; _way++ )
-        {
-            if ( cache_state(_way, *set) == CACHE_SLOT_STATE_EMPTY )
+        for ( size_t _way = 0 ; _way < m_ways && !(*found) ; _way++ )
+        {
+            if ( cache_state(_way, _set) == CACHE_SLOT_STATE_EMPTY )
             {
                 *found   = true;
@@ -613,34 +617,28 @@
         }
         // Search first not zombi old slot 
-        if ( !found )
-        { 
-            for ( size_t _way = 0 ; _way < m_ways && !found ; _way++ )
-            {
-                if ( not cache_lru(_way, *set) and 
-                     (cache_state(_way, *set) != CACHE_SLOT_STATE_ZOMBI) )
-                {
-                    *found   = true;
-                    *cleanup = true;
-                    *way     = _way;
-                    *set     = m_y[ad];
-                    *victim  = (addr_t)((cache_tag(*way,*set) * m_sets) + *set);
-                    return;
-                }
+        for ( size_t _way = 0 ; _way < m_ways && !(*found) ; _way++ )
+        {
+            if ( not cache_lru(_way, _set) and 
+                 (cache_state(_way, _set) != CACHE_SLOT_STATE_ZOMBI) )
+            {
+                *found   = true;
+                *cleanup = true;
+                *way     = _way;
+                *set     = m_y[ad];
+                *victim  = (addr_t)((cache_tag(*way,_set) * m_sets) + _set);
+                return;
             }
         }
         // Search first not zombi slot
-        if ( !found )
-        { 
-            for ( size_t _way = 0 ; _way < m_ways && !found ; _way++ )
-            {
-                if ( cache_state(_way, *set) != CACHE_SLOT_STATE_ZOMBI) 
-                {
-                    *found   = true;
-                    *cleanup = true;
-                    *way    = _way;
-                    *set     = m_y[ad];
-                    *victim  = (addr_t)((cache_tag(*way,*set) * m_sets) + *set);
-                    return;
-                }
+        for ( size_t _way = 0 ; _way < m_ways && !(*found) ; _way++ )
+        {
+            if ( cache_state(_way, _set) != CACHE_SLOT_STATE_ZOMBI) 
+            {
+                *found   = true;
+                *cleanup = true;
+                *way    = _way;
+                *set     = m_y[ad];
+                *victim  = (addr_t)((cache_tag(*way,_set) * m_sets) + _set);
+                return;
             }
         }
