From ccb5bb34d73f34461abe180f36b3c2b9e45cc933 Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Fri, 10 Oct 2014 08:58:18 -0700 Subject: Suggested patch for type-punned warnings --- src/misc/vec/vecHsh.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/misc/vec/vecHsh.h') diff --git a/src/misc/vec/vecHsh.h b/src/misc/vec/vecHsh.h index 34a6c993..8fcf7b0a 100644 --- a/src/misc/vec/vecHsh.h +++ b/src/misc/vec/vecHsh.h @@ -46,6 +46,13 @@ struct Hsh_IntObj_t_ int iNext; }; +typedef union Hsh_IntObjWord_t_ Hsh_IntObjWord_t; +union Hsh_IntObjWord_t_ +{ + Hsh_IntObj_t wObj; + word wWord; +}; + typedef struct Hsh_IntMan_t_ Hsh_IntMan_t; struct Hsh_IntMan_t_ { @@ -80,7 +87,7 @@ struct Hsh_VecMan_t_ static inline unsigned * Hsh_IntData( Hsh_IntMan_t * p, int iData ) { return (unsigned *)Vec_IntEntryP( p->vData, p->nSize * iData ); } static inline Hsh_IntObj_t * Hsh_IntObj( Hsh_IntMan_t * p, int iObj ) { return iObj == -1 ? NULL : (Hsh_IntObj_t *)Vec_WrdEntryP( p->vObjs, iObj ); } -static inline word Hsh_IntWord( int iData, int iNext ) { Hsh_IntObj_t Obj = {iData, iNext}; return *((word *)&Obj); } +static inline word Hsh_IntWord( int iData, int iNext ) { Hsh_IntObjWord_t Obj = { {iData, iNext} }; return Obj.wWord; } static inline Hsh_VecObj_t * Hsh_VecObj( Hsh_VecMan_t * p, int i ) { return i == -1 ? NULL : (Hsh_VecObj_t *)Vec_IntEntryP(p->vData, Vec_IntEntry(p->vMap, i)); } -- cgit v1.2.3