Fix alignment issues (can remove a clang warning, and also makes our code more portable!)

This commit is contained in:
Dale Weiler 2013-04-25 03:17:52 +00:00
parent bfbb60bbed
commit 1b5504fb9e
3 changed files with 2 additions and 4 deletions

View file

@ -29,7 +29,6 @@ ifeq ($(CC), clang)
-Wno-conversion \
-Wno-missing-prototypes \
-Wno-float-equal \
-Wno-cast-align \
-Wno-missing-variable-declarations \
-Wno-unknown-warning-option
else

View file

@ -361,7 +361,7 @@ void _util_vec_grow(void **a, size_t i, size_t s);
)
/* exposed interface */
#define vec_meta(A) (((vector_t*)(A)) - 1)
#define vec_meta(A) (((vector_t*)((void*)A)) - 1)
#define vec_free(A) ((void)((A) ? (mem_d((void*)vec_meta(A)), (A) = NULL) : 0))
#define vec_push(A,V) (GMQCC_VEC_WILLGROW((A),1), (A)[vec_meta(A)->used++] = (V))
#define vec_size(A) ((A) ? vec_meta(A)->used : 0)

3
util.c
View file

@ -465,8 +465,7 @@ GMQCC_INLINE size_t util_hthash(hash_table_t *ht, const char *key) {
const unsigned char *data = (const unsigned char*)key;
while (size >= 4) {
alias = *(uint32_t*)data;
alias = (data[0] | (data[1] << 8) | (data[2] << 16) | (data[3] << 24));
alias *= mix;
alias ^= alias >> rot;
alias *= mix;