AllocWinding: fix handling of compiler enforced alignment of double

This commit is contained in:
Rudolf Polzer 2011-12-08 12:20:56 +01:00
parent 9e69c83769
commit 4afa1f6427
2 changed files with 4 additions and 4 deletions

View File

@ -67,7 +67,7 @@ winding_t *AllocWinding (int points)
if (c_active_windings > c_peak_windings)
c_peak_windings = c_active_windings;
}
s = sizeof(vec_t)*3*points + sizeof(int);
s = sizeof(*w) + (points ? sizeof(w->p[0])*(points-1) : 0);
w = safe_malloc (s);
memset (w, 0, s);
return w;
@ -95,7 +95,7 @@ winding_accu_t *AllocWindingAccu(int points)
if (c_active_windings > c_peak_windings)
c_peak_windings = c_active_windings;
}
s = sizeof(vec_accu_t) * 3 * points + sizeof(int);
s = sizeof(*w) + (points ? sizeof(w->p[0])*(points-1) : 0);
w = safe_malloc(s);
memset(w, 0, s);
return w;

View File

@ -23,7 +23,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
typedef struct
{
int numpoints;
vec3_t p[4]; // variable sized
vec3_t p[1]; // variable sized
} winding_t;
#define MAX_POINTS_ON_WINDING 512
@ -67,7 +67,7 @@ void pw(winding_t *w);
typedef struct
{
int numpoints;
vec3_accu_t p[4]; // variable sized
vec3_accu_t p[1]; // variable sized
} winding_accu_t;
winding_accu_t *BaseWindingForPlaneAccu(vec3_t normal, vec_t dist);