mirror of
https://github.com/alliedmodders/hl2sdk.git
synced 2025-09-20 12:36:05 +08:00
Port offsetof "fix" from sdk2013.
This commit is contained in:
@ -110,10 +110,6 @@ DECLARE_FIELD_SIZE( FIELD_MODELINDEX, sizeof(int) )
|
|||||||
DECLARE_FIELD_SIZE( FIELD_MATERIALINDEX, 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 ARRAYSIZE2D(p) (sizeof(p)/sizeof(p[0][0]))
|
||||||
|
|
||||||
#define _FIELD(name,fieldtype,count,flags,mapname,tolerance) { fieldtype, #name, { offsetof(classNameTypedef, name), 0 }, count, flags, mapname, NULL, NULL, NULL, sizeof( ((classNameTypedef *)0)->name ), NULL, 0, tolerance }
|
#define _FIELD(name,fieldtype,count,flags,mapname,tolerance) { fieldtype, #name, { offsetof(classNameTypedef, name), 0 }, count, flags, mapname, NULL, NULL, NULL, sizeof( ((classNameTypedef *)0)->name ), NULL, 0, tolerance }
|
||||||
|
@ -23,9 +23,6 @@
|
|||||||
#include "utlvector.h"
|
#include "utlvector.h"
|
||||||
|
|
||||||
|
|
||||||
#ifndef offsetof
|
|
||||||
#define offsetof(s,m) (size_t)&(((s *)0)->m)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -223,6 +223,16 @@ typedef void * HINSTANCE;
|
|||||||
#define MAX_PATH 260
|
#define MAX_PATH 260
|
||||||
#endif
|
#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
|
||||||
|
|
||||||
// Used to step into the debugger
|
// Used to step into the debugger
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#define DebuggerBreak() __asm { int 3 }
|
#define DebuggerBreak() __asm { int 3 }
|
||||||
|
@ -22,10 +22,6 @@ namespace vgui
|
|||||||
|
|
||||||
////////////// MESSAGEMAP DEFINITIONS //////////////
|
////////////// MESSAGEMAP DEFINITIONS //////////////
|
||||||
|
|
||||||
#ifndef offsetof
|
|
||||||
#define offsetof(s,m) (size_t)&(((s *)0)->m)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ARRAYSIZE
|
#ifndef ARRAYSIZE
|
||||||
#define ARRAYSIZE(p) (sizeof(p)/sizeof(p[0]))
|
#define ARRAYSIZE(p) (sizeof(p)/sizeof(p[0]))
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user