fix 32 bit atoms to ensure alignment at 8 bytes (broken with blobs).

This commit is contained in:
Vitor Santos Costa 2010-12-02 11:49:58 +00:00
parent 514758e65b
commit b02507ed22
3 changed files with 9 additions and 6 deletions

View File

@ -27,6 +27,11 @@
#include <wchar.h>
typedef struct atom_blob {
size_t length;
char data[MIN_ARRAY];
} atom_blob_t;
/********* operations for atoms ****************************************/
/* Atoms are assumed to be uniquely represented by an OFFSET and to have
@ -55,10 +60,7 @@ typedef struct AtomEntryStruct
union {
char uStrOfAE[MIN_ARRAY]; /* representation of atom as a string */
wchar_t uWStrOfAE[MIN_ARRAY]; /* representation of atom as a string */
struct {
size_t length; /* size of blob */
char data[MIN_ARRAY]; /* data */
} blob;
struct atom_blob blob[MIN_ARRAY];
} rep;
}
AtomEntry;

View File

@ -1604,3 +1604,4 @@ PredPropByAtom (Atom at, Term cur_mod)
#endif
#endif

View File

@ -85,11 +85,11 @@ PL_blob_data(atom_t a, size_t *len, struct PL_blob_t **type)
return x->StrOfAE;
}
if ( len )
*len = x->rep.blob.length;
*len = x->rep.blob[0].length;
if ( type )
*type = RepBlobProp(x->PropsOfAE)->blob_t;
return x->rep.blob.data;
return x->rep.blob[0].data;
}
PL_EXPORT(void)