Platform Independent Lockless Hashing
Posted: 02 Jun 2007, 13:47
The lockless hashing technique described here assumed 64-bit atomic operations:
Does the compiler translate the 64-bit xor into two 32-bit xors and the 64-bit store into two 32-bit stores for 32-bits exe? If so, this will still work assuming 32-bit or 16-bit or 8-bit atomic operations right?
- Code: Select all
typedef struct _hashEntry
{
U64 hashkey;
U64 data;
}hashEntry;
void storeEntry(hashEntry* h)
{
hashEntry* volatile bucket = hashtable + ((h->hashkey)%HT_SIZE);
bucket->hashkey = h->hashkey^h->data;
bucket->data = h->data;
}
Does the compiler translate the 64-bit xor into two 32-bit xors and the 64-bit store into two 32-bit stores for 32-bits exe? If so, this will still work assuming 32-bit or 16-bit or 8-bit atomic operations right?