1
0
mirror of https://github.com/alliedmodders/hl2sdk.git synced 2024-12-23 01:59:43 +08:00

Port offsetof "fix" from sdk2013.

This commit is contained in:
Nicholas Hastings 2014-11-09 10:27:08 -05:00
parent 447733236a
commit f46e912fa8
4 changed files with 11 additions and 12 deletions

View File

@ -120,10 +120,6 @@ DECLARE_FIELD_SIZE( FIELD_MODELINDEX, sizeof(int) )
DECLARE_FIELD_SIZE( FIELD_MATERIALINDEX, sizeof(int) )
#ifndef offsetof
#define offsetof(s,m) (size_t)&(((s *)0)->m)
#endif
#define ARRAYSIZE2D(p) (sizeof(p)/sizeof(p[0][0]))
#define SIZE_OF_ARRAY(p) _ARRAYSIZE(p)

View File

@ -28,10 +28,6 @@
#include "localflexcontroller.h"
#ifndef offsetof
#define offsetof(s,m) (size_t)&(((s *)0)->m)
#endif
#define STUDIO_ENABLE_PERF_COUNTERS
#define STUDIO_SEQUENCE_ACTIVITY_LOOKUPS_ARE_SLOW 0

View File

@ -252,6 +252,17 @@ typedef void * HINSTANCE;
#define MAX_PATH 260
#endif
#ifdef GNUC
#undef offsetof
//#define offsetof( type, var ) __builtin_offsetof( type, var )
#define offsetof(s,m) (size_t)&(((s *)0)->m)
#else
#undef offsetof
#define offsetof(s,m) (size_t)&(((s *)0)->m)
#endif
#define ALIGN_VALUE( val, alignment ) ( ( val + alignment - 1 ) & ~( alignment - 1 ) ) // need macro for constant expression
// Used to step into the debugger

View File

@ -22,10 +22,6 @@ namespace vgui
////////////// MESSAGEMAP DEFINITIONS //////////////
#ifndef offsetof
#define offsetof(s,m) (size_t)&(((s *)0)->m)
#endif
#ifndef ARRAYSIZE
#define ARRAYSIZE(p) (sizeof(p)/sizeof(p[0]))
#endif