From 2beff65988a6f19eb8794542a5ce5f922414a122 Mon Sep 17 00:00:00 2001 From: Frits van Bommel Date: Fri, 27 Feb 2009 12:35:31 +0100 Subject: [PATCH] Fix struct field alignment on x86-64 (for align > 8, like real.alignof) --- dmd/struct.c | 6 +++--- dmd2/struct.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dmd/struct.c b/dmd/struct.c index b23db0d6..c72a0072 100644 --- a/dmd/struct.c +++ b/dmd/struct.c @@ -130,7 +130,7 @@ int AggregateDeclaration::isDeprecated() void AggregateDeclaration::alignmember(unsigned salign, unsigned size, unsigned *poffset) { - //printf("salign = %d, size = %d, offset = %d\n",salign,size,offset); + //printf("salign = %d, size = %d, offset = %d\n",salign,size,*poffset); if (salign > 1) { int sa; @@ -148,11 +148,11 @@ void AggregateDeclaration::alignmember(unsigned salign, unsigned size, unsigned *poffset = (*poffset + 3) & ~3; // align to dword break; default: - *poffset = (*poffset + salign - 1) & ~(salign - 1); + *poffset = (*poffset + size - 1) & ~(size - 1); break; } } - //printf("result = %d\n",offset); + //printf("result = %d\n",*poffset); } diff --git a/dmd2/struct.c b/dmd2/struct.c index 45c17276..7882ee68 100644 --- a/dmd2/struct.c +++ b/dmd2/struct.c @@ -134,7 +134,7 @@ int AggregateDeclaration::isDeprecated() void AggregateDeclaration::alignmember(unsigned salign, unsigned size, unsigned *poffset) { - //printf("salign = %d, size = %d, offset = %d\n",salign,size,offset); + //printf("salign = %d, size = %d, offset = %d\n",salign,size,*poffset); if (salign > 1) { int sa; @@ -152,11 +152,11 @@ void AggregateDeclaration::alignmember(unsigned salign, unsigned size, unsigned *poffset = (*poffset + 3) & ~3; // align to dword break; default: - *poffset = (*poffset + salign - 1) & ~(salign - 1); + *poffset = (*poffset + size - 1) & ~(size - 1); break; } } - //printf("result = %d\n",offset); + //printf("result = %d\n",*poffset); }