mirror of
https://github.com/alliedmodders/hl2sdk.git
synced 2025-01-03 16:13:22 +08:00
add Size back to utlvector, fix stackalloc/free definitions
This commit is contained in:
parent
987b95b035
commit
aec6d4eca4
@ -381,8 +381,17 @@ typedef void * HINSTANCE;
|
||||
//-----------------------------------------------------------------------------
|
||||
// Stack-based allocation related helpers
|
||||
//-----------------------------------------------------------------------------
|
||||
#ifdef _WIN32
|
||||
// Alloca defined for this platform
|
||||
#define stackalloc( _size ) _alloca( ALIGN_VALUE( _size, 16 ) )
|
||||
#define stackfree( _p )
|
||||
#elif defined(_LINUX) || defined(__APPLE__)
|
||||
// Alloca defined for this platform
|
||||
#define stackalloc( _size ) alloca( ALIGN_VALUE( _size, 16 ) )
|
||||
#define stackfree( _p )
|
||||
#endif
|
||||
|
||||
#if defined( GNUC )
|
||||
#define stackalloc( _size ) alloca( ALIGN_VALUE( _size, 16 ) )
|
||||
#ifdef _LINUX
|
||||
#define mallocsize( _p ) ( malloc_usable_size( _p ) )
|
||||
#elif defined(OSX)
|
||||
@ -391,12 +400,9 @@ typedef void * HINSTANCE;
|
||||
#error
|
||||
#endif
|
||||
#elif defined ( _WIN32 )
|
||||
#define stackalloc( _size ) _alloca( ALIGN_VALUE( _size, 16 ) )
|
||||
#define mallocsize( _p ) ( _msize( _p ) )
|
||||
#endif
|
||||
|
||||
#define stackfree( _p ) 0
|
||||
|
||||
// Linux had a few areas where it didn't construct objects in the same order that Windows does.
|
||||
// So when CVProfile::CVProfile() would access g_pMemAlloc, it would crash because the allocator wasn't initalized yet.
|
||||
#if defined(_LINUX) || defined(__APPLE__)
|
||||
@ -498,28 +504,6 @@ typedef void * HINSTANCE;
|
||||
// as little code as possible, and throw an assertion in debug.
|
||||
#define NO_DEFAULT default: UNREACHABLE();
|
||||
|
||||
#ifdef _WIN32
|
||||
// Alloca defined for this platform
|
||||
#define stackalloc( _size ) _alloca( ALIGN_VALUE( _size, 16 ) )
|
||||
#define stackfree( _p )
|
||||
#elif defined(_LINUX) || defined(__APPLE__)
|
||||
// Alloca defined for this platform
|
||||
#define stackalloc( _size ) alloca( ALIGN_VALUE( _size, 16 ) )
|
||||
#define stackfree( _p )
|
||||
#endif
|
||||
|
||||
#if defined( GNUC )
|
||||
#ifdef _LINUX
|
||||
#define mallocsize( _p ) ( malloc_usable_size( _p ) )
|
||||
#elif defined(OSX)
|
||||
#define mallocsize( _p ) ( malloc_size( _p ) )
|
||||
#else
|
||||
#error
|
||||
#endif
|
||||
#elif defined ( _WIN32 )
|
||||
#define mallocsize( _p ) ( _msize( _p ) )
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#define RESTRICT __restrict
|
||||
#define RESTRICT_FUNC __declspec(restrict)
|
||||
|
@ -66,6 +66,7 @@ public:
|
||||
|
||||
// Returns the number of elements in the vector
|
||||
int Count() const;
|
||||
int Size() const { return Count(); }
|
||||
|
||||
// Is element index valid?
|
||||
bool IsValidIndex( int i ) const;
|
||||
|
Loading…
x
Reference in New Issue
Block a user