1
0
Fork 0

(svn r17101) -Revert [FS#3065](r16546): large table on stack caused stack overflow on some architectures

release/1.0
smatz 2009-08-07 13:33:55 +00:00
parent ba4fd897b8
commit 135f80f95b
1 changed files with 10 additions and 10 deletions

View File

@ -133,16 +133,19 @@ protected:
* Titem contains pointer to the next item - GetHashNext(), SetHashNext() */ * Titem contains pointer to the next item - GetHashNext(), SetHashNext() */
typedef CHashTableSlotT<Titem_> Slot; typedef CHashTableSlotT<Titem_> Slot;
Slot m_slots[Tcapacity]; ///< here we store our data (array of blobs) Slot *m_slots; // here we store our data (array of blobs)
int m_num_items; ///< item counter int m_num_items; // item counter
public: public:
/* default constructor */ /* default constructor */
FORCEINLINE CHashTableT() : FORCEINLINE CHashTableT()
m_num_items(0) {
{ } /* construct all slots */
m_slots = new Slot[Tcapacity];
m_num_items = 0;
}
FORCEINLINE ~CHashTableT() { } ~CHashTableT() {delete [] m_slots; m_num_items = 0; m_slots = NULL;}
protected: protected:
/** static helper - return hash for the given key modulo number of slots */ /** static helper - return hash for the given key modulo number of slots */
@ -165,10 +168,7 @@ public:
FORCEINLINE int Count() const {return m_num_items;} FORCEINLINE int Count() const {return m_num_items;}
/** simple clear - forget all items - used by CSegmentCostCacheT.Flush() */ /** simple clear - forget all items - used by CSegmentCostCacheT.Flush() */
FORCEINLINE void Clear() FORCEINLINE void Clear() const {for (int i = 0; i < Tcapacity; i++) m_slots[i].Clear();}
{
for (size_t i = 0; i < lengthof(m_slots); i++) m_slots[i].Clear();
}
/** const item search */ /** const item search */
const Titem_ *Find(const Tkey& key) const const Titem_ *Find(const Tkey& key) const