Skip to content

Commit c806485

Browse files
committed
Resolve UtlSymLargeId_t differences
1 parent 8441bc8 commit c806485

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

public/tier1/utlsymbollarge.h

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#pragma once
1414
#endif
1515

16+
#include "tier0/platform.h"
1617
#include "tier0/threadtools.h"
1718
#include "tier1/generichash.h"
1819
#include "tier1/utlvector.h"
@@ -30,13 +31,14 @@
3031
//-----------------------------------------------------------------------------
3132

3233
typedef intp UtlSymLargeId_t;
34+
typedef uint UtlSymLargeElm_t;
3335

3436
#define UTL_INVAL_SYMBOL_LARGE ((UtlSymLargeId_t)0)
3537

3638
#define FOR_EACH_SYMBOL_LARGE( table, iter ) \
37-
for ( UtlSymLargeId_t iter = 0; iter < (table).GetNumStrings(); iter++ )
39+
for ( UtlSymLargeElm_t iter = 0; iter < (table).GetNumStrings(); iter++ )
3840
#define FOR_EACH_SYMBOL_LARGE_BACK( table, iter ) \
39-
for ( UtlSymLargeId_t iter = (table).GetNumStrings()-1; iter >= 0; iter-- )
41+
for ( UtlSymLargeElm_t iter = (table).GetNumStrings()-1; iter >= 0; iter-- )
4042

4143
class CUtlSymbolLarge
4244
{
@@ -127,8 +129,8 @@ class CUtlSymbolTableLargeBase
127129
CUtlSymbolLarge Find( const char* pString ) const;
128130
CUtlSymbolLarge Find( const char* pString, int nLength ) const;
129131

130-
const char* String( UtlSymLargeId_t id ) const;
131-
unsigned int Hash( UtlSymLargeId_t id ) const;
132+
const char* String( UtlSymLargeElm_t elem ) const;
133+
unsigned int Hash( UtlSymLargeElm_t elem ) const;
132134

133135
int GetNumStrings() const { return m_MemBlocks.Count(); };
134136

@@ -163,7 +165,7 @@ class CUtlSymbolTableLargeBase
163165
return CUtlSymbolLarge::Hash< CASEINSENSITIVE >( k.m_pString, k.m_nLength );
164166
}
165167

166-
unsigned int operator()( UtlSymLargeId_t k ) const
168+
unsigned int operator()( UtlSymLargeElm_t k ) const
167169
{
168170
const CUtlSymbolTableLargeBase* pTable = (const CUtlSymbolTableLargeBase*)((uintp)this + m_ownerOffset);
169171

@@ -182,7 +184,7 @@ class CUtlSymbolTableLargeBase
182184
m_ownerOffset = -owneroffset;
183185
}
184186

185-
bool operator()( UtlSymLargeId_t a, UtlSymLargeId_t b ) const
187+
bool operator()( UtlSymLargeElm_t a, UtlSymLargeElm_t b ) const
186188
{
187189
const CUtlSymbolTableLargeBase* pTable = (const CUtlSymbolTableLargeBase*)((uintp)this + m_ownerOffset);
188190

@@ -192,7 +194,7 @@ class CUtlSymbolTableLargeBase
192194
return V_strcmp( pTable->String( a ), pTable->String( b ) ) == 0;
193195
}
194196

195-
bool operator()( UtlSymTableLargeAltKey a, UtlSymLargeId_t b ) const
197+
bool operator()( UtlSymTableLargeAltKey a, UtlSymLargeElm_t b ) const
196198
{
197199
const char* pString = a.m_pTable->String( b );
198200
int nLength = strlen( pString );
@@ -206,14 +208,14 @@ class CUtlSymbolTableLargeBase
206208
return V_strncmp( a.m_pString, pString, a.m_nLength ) == 0;
207209
}
208210

209-
bool operator()( UtlSymLargeId_t a, UtlSymTableLargeAltKey b ) const
211+
bool operator()( UtlSymLargeElm_t a, UtlSymTableLargeAltKey b ) const
210212
{
211213
return operator()( b, a );
212214
}
213215
};
214216

215-
typedef CUtlHashtable<UtlSymLargeId_t, empty_t, UtlSymTableLargeHashFunctor, UtlSymTableLargeEqualFunctor, UtlSymTableLargeAltKey, CUtlMemory_RawAllocator<CUtlHashtableEntry<UtlSymLargeId_t, empty_t>>> Hashtable_t;
216-
typedef CUtlVector< MemBlockHandle_t, CUtlMemory_RawAllocator<MemBlockHandle_t> > MemBlocksVec_t;
217+
typedef CUtlHashtable< UtlSymLargeElm_t, empty_t, UtlSymTableLargeHashFunctor, UtlSymTableLargeEqualFunctor, UtlSymTableLargeAltKey, CUtlMemory_RawAllocator< CUtlHashtableEntry< UtlSymLargeElm_t, empty_t > > > Hashtable_t;
218+
typedef CUtlVector< MemBlockHandle_t, CUtlMemory_RawAllocator< MemBlockHandle_t > > MemBlocksVec_t;
217219

218220
Hashtable_t m_HashTable;
219221
MemBlocksVec_t m_MemBlocks;
@@ -277,13 +279,13 @@ inline CUtlSymbolLarge CUtlSymbolTableLargeBase< CASEINSENSITIVE, PAGE_SIZE, MUT
277279
}
278280

279281
template < bool CASEINSENSITIVE, size_t PAGE_SIZE, class MUTEX_TYPE >
280-
inline const char* CUtlSymbolTableLargeBase< CASEINSENSITIVE, PAGE_SIZE, MUTEX_TYPE >::String( UtlSymLargeId_t id ) const
282+
inline const char* CUtlSymbolTableLargeBase< CASEINSENSITIVE, PAGE_SIZE, MUTEX_TYPE >::String( UtlSymLargeElm_t elem ) const
281283
{
282284
return ( const char* )m_MemBlockAllocator.GetBlock( m_MemBlocks[ id ] );
283285
}
284286

285287
template < bool CASEINSENSITIVE, size_t PAGE_SIZE, class MUTEX_TYPE >
286-
inline unsigned int CUtlSymbolTableLargeBase< CASEINSENSITIVE, PAGE_SIZE, MUTEX_TYPE >::Hash( UtlSymLargeId_t id ) const
288+
inline unsigned int CUtlSymbolTableLargeBase< CASEINSENSITIVE, PAGE_SIZE, MUTEX_TYPE >::Hash( UtlSymLargeElm_t elem ) const
287289
{
288290
CUtlSymbolTableLargeBaseTreeEntry_t *entry = (CUtlSymbolTableLargeBaseTreeEntry_t *)m_MemBlockAllocator.GetBlock( m_MemBlocks[ id ] - sizeof( LargeSymbolTableHashDecoration_t ) );
289291

0 commit comments

Comments
 (0)