mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2025-01-31 12:00:38 +00:00
Fix alignment issues (can remove a clang warning, and also makes our code more portable!)
This commit is contained in:
parent
bfbb60bbed
commit
1b5504fb9e
3 changed files with 2 additions and 4 deletions
1
Makefile
1
Makefile
|
@ -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
|
||||
|
|
2
gmqcc.h
2
gmqcc.h
|
@ -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
3
util.c
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue