diff options
author | Kavon Farvardin <kavon@farvard.in> | 2018-09-23 15:29:37 -0500 |
---|---|---|
committer | Kavon Farvardin <kavon@farvard.in> | 2018-09-23 15:29:37 -0500 |
commit | 84c2ad99582391005b5e873198b15e9e9eb4f78d (patch) | |
tree | caa8c2f2ec7e97fbb4977263c6817c9af5025cf4 /rts/StaticPtrTable.c | |
parent | 8ddb47cfcf5776e9a3c55fd37947c8a95e00fa12 (diff) | |
parent | e68b439fe5de61b9a2ca51af472185c62ccb8b46 (diff) | |
download | haskell-wip/T13904.tar.gz |
update to current master againwip/T13904
Diffstat (limited to 'rts/StaticPtrTable.c')
-rw-r--r-- | rts/StaticPtrTable.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/rts/StaticPtrTable.c b/rts/StaticPtrTable.c index 5d2737a262..0b2244025e 100644 --- a/rts/StaticPtrTable.c +++ b/rts/StaticPtrTable.c @@ -12,7 +12,7 @@ #include "Rts.h" #include "RtsUtils.h" #include "Hash.h" -#include "Stable.h" +#include "StablePtr.h" static HashTable * spt = NULL; @@ -21,23 +21,24 @@ static Mutex spt_lock; #endif /// Hash function for the SPT. -static int hashFingerprint(HashTable *table, StgWord64 key[2]) { +static int hashFingerprint(const HashTable *table, StgWord key) { + const StgWord64* ptr = (StgWord64*) key; // Take half of the key to compute the hash. - return hashWord(table, (StgWord)key[1]); + return hashWord(table, *(ptr + 1)); } /// Comparison function for the SPT. -static int compareFingerprint(StgWord64 ptra[2], StgWord64 ptrb[2]) { - return ptra[0] == ptrb[0] && ptra[1] == ptrb[1]; +static int compareFingerprint(StgWord a, StgWord b) { + const StgWord64* ptra = (StgWord64*) a; + const StgWord64* ptrb = (StgWord64*) b; + return *ptra == *ptrb && *(ptra + 1) == *(ptrb + 1); } void hs_spt_insert_stableptr(StgWord64 key[2], StgStablePtr *entry) { // hs_spt_insert is called from constructor functions, so // the SPT needs to be initialized here. if (spt == NULL) { - spt = allocHashTable_( (HashFunction *)hashFingerprint - , (CompareFunction *)compareFingerprint - ); + spt = allocHashTable_(hashFingerprint, compareFingerprint); #if defined(THREADED_RTS) initMutex(&spt_lock); #endif |