Last active
December 10, 2015 20:28
-
-
Save chriswailes/4488037 to your computer and use it in GitHub Desktop.
A set of chpl_defaultHash implementations for atomic types.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inline proc chpl__defaultHash(ref aflag:atomic_flag):int(64) { | |
if (atomic_load_explicit_flag(aflag, memory_order_consume)) then | |
return 0; | |
else | |
return 1; | |
} | |
inline proc chpl__defaultHash(ref auint:atomic_uint_least8_t):int(64) { | |
return _gen_key(atomic_load_explicit_uint_least8_t(auint, memory_order_consume):int(64)); | |
} | |
inline proc chpl__defaultHash(ref auint:atomic_uint_least16_t):int(64) { | |
return _gen_key(atomic_load_explicit_uint_least16_t(auint, memory_order_consume):int(64)); | |
} | |
inline proc chpl__defaultHash(ref auint:atomic_uint_least32_t):int(64) { | |
return _gen_key(atomic_load_explicit_uint_least32_t(auint, memory_order_consume):int(64)); | |
} | |
inline proc chpl__defaultHash(ref auint:atomic_uint_least64_t):int(64) { | |
return _gen_key(atomic_load_explicit_uint_least64_t(auint, memory_order_consume):int(64)); | |
} | |
inline proc chpl__defaultHash(ref aint:atomic_int_least8_t):int(64) { | |
return _gen_key(atomic_load_explicit_int_least8_t(aint, memory_order_consume):int(64)); | |
} | |
inline proc chpl__defaultHash(ref aint:atomic_int_least16_t):int(64) { | |
return _gen_key(atomic_load_explicit_int_least16_t(aint, memory_order_consume):int(64)); | |
} | |
inline proc chpl__defaultHash(ref aint:atomic_int_least32_t):int(64) { | |
return _gen_key(atomic_load_explicit_int_least32_t(aint, memory_order_consume):int(64)); | |
} | |
inline proc chpl__defaultHash(ref aint:atomic_int_least64_t):int(64) { | |
return _gen_key(atomic_load_explicit_int_least64_t(aint, memory_order_consume)); | |
} | |
inline proc chpl__defaultHash(ref afloat:atomic__real32):int(64) { | |
var r:real(32) = atomic_load_explicit__real32(afloat, memory_order_consume); | |
return _gen_key(__primitive( "real2int", r)); | |
} | |
inline proc chpl__defaultHash(ref afloat:atomic__real64):int(64) { | |
var r:real(64) = atomic_load_explicit__real64(afloat, memory_order_consume); | |
return _gen_key(__primitive( "real2int", r)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment