Keep maxbins in sync with max threaded cache. Fixes memory corruption and out of bounds access

git-svn-id: https://svn.eduke32.com/eduke32@1441 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
qbix79 2009-06-26 17:04:46 +00:00
parent 3d0c34863d
commit f38c6ceea7

View file

@ -88,10 +88,22 @@ DEALINGS IN THE SOFTWARE.
#endif #endif
#if 1 #if 1
/* The number of cache entries for finer grained bins. This is (topbitpos(THREADCACHEMAX)-4)*2 */ /* The number of cache entries for finer grained bins. This is (topbitpos(THREADCACHEMAX)-4)*2 */
#if THREADCACHEMAX == 8192
#define THREADCACHEMAXBINS ((13-4)*2) #define THREADCACHEMAXBINS ((13-4)*2)
#elif THREADCACHEMAX == 65536
#define THREADCACHEMAXBINS ((16-4)*2)
#else
#error undefined size
#endif
#else #else
/* The number of cache entries. This is (topbitpos(THREADCACHEMAX)-4) */ /* The number of cache entries. This is (topbitpos(THREADCACHEMAX)-4) */
#if THREADCACHEMAX == 8192
#define THREADCACHEMAXBINS (13-4) #define THREADCACHEMAXBINS (13-4)
#elif THREADCACHEMAX == 65536
#define THREADCACHEMAXBINS (16-4)
#else
#error undefined size
#endif
#endif #endif
/* Point at which the free space in a thread cache is garbage collected */ /* Point at which the free space in a thread cache is garbage collected */
#ifndef THREADCACHEMAXFREESPACE #ifndef THREADCACHEMAXFREESPACE