summaryrefslogtreecommitdiffstats
path: root/src/misc/vec
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2014-10-10 08:58:18 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2014-10-10 08:58:18 -0700
commitccb5bb34d73f34461abe180f36b3c2b9e45cc933 (patch)
tree74342a3dc5291fa48cff9a792df8c6791833dd46 /src/misc/vec
parentca9eca3b227ae3f8a60038ba9c295f5383a6826d (diff)
downloadabc-ccb5bb34d73f34461abe180f36b3c2b9e45cc933.tar.gz
abc-ccb5bb34d73f34461abe180f36b3c2b9e45cc933.tar.bz2
abc-ccb5bb34d73f34461abe180f36b3c2b9e45cc933.zip
Suggested patch for type-punned warnings
Diffstat (limited to 'src/misc/vec')
-rw-r--r--src/misc/vec/vecHsh.h9
1 files changed, 8 insertions, 1 deletions
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)); }