1
0
mirror of https://github.com/alliedmodders/hl2sdk.git synced 2025-01-04 00:23:25 +08:00

Port offsetof "fix" from swarm sdk.

This commit is contained in:
Nicholas Hastings 2014-11-09 10:36:58 -05:00
parent 4790e1a62d
commit a003cc3ca3
4 changed files with 11 additions and 10 deletions

View File

@ -123,10 +123,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,9 +28,6 @@
#include "localflexcontroller.h"
#ifndef offsetof
#define offsetof(s,m) (size_t)&(((s *)0)->m)
#endif
#define STUDIO_ENABLE_PERF_COUNTERS

View File

@ -156,6 +156,17 @@ typedef double float64;
// for when we don't care about how many bits we use
typedef unsigned int uint;
#ifdef GNUC
#undef offsetof
//#define offsetof( type, var ) __builtin_offsetof( type, var )
#define offsetof(s,m) (size_t)&(((s *)0)->m)
#else
#include <stddef.h>
#undef offsetof
#define offsetof(s,m) (size_t)&(((s *)0)->m)
#endif
// This can be used to ensure the size of pointers to members when declaring
// a pointer type for a class that has only been forward declared
#ifdef _MSC_VER

View File

@ -22,9 +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]))