243 unsigned char*: cx_hash_key_ustr, \ |
244 unsigned char*: cx_hash_key_ustr, \ |
244 const unsigned char*: cx_hash_key_ustr, \ |
245 const unsigned char*: cx_hash_key_ustr, \ |
245 uint32_t: cx_hash_key_u32, \ |
246 uint32_t: cx_hash_key_u32, \ |
246 uint64_t: cx_hash_key_u64) \ |
247 uint64_t: cx_hash_key_u64) \ |
247 (key) |
248 (key) |
248 |
249 #endif // __cplusplus |
249 |
250 |
250 /** |
251 /** |
251 * Computes a hash key from a UCX string. |
252 * Computes a hash key from a UCX string. |
252 * Convenience macro that accepts both cxstring and cxmutstr. |
253 * Convenience macro that accepts both cxstring and cxmutstr. |
253 * @deprecated use the CX_HASH_KEY() macro instead |
254 * @deprecated use the CX_HASH_KEY() macro instead |
268 cx_attr_export |
269 cx_attr_export |
269 int cx_hash_key_cmp(const CxHashKey *left, const CxHashKey *right); |
270 int cx_hash_key_cmp(const CxHashKey *left, const CxHashKey *right); |
270 |
271 |
271 #ifdef __cplusplus |
272 #ifdef __cplusplus |
272 } // extern "C" |
273 } // extern "C" |
|
274 |
|
275 // ---------------------------------------------------------- |
|
276 // Overloads of CX_HASH_KEY (the C++ version of a _Generic) |
|
277 // ---------------------------------------------------------- |
|
278 |
|
279 static inline CxHashKey CX_HASH_KEY(CxHashKey key) { |
|
280 return key; |
|
281 } |
|
282 |
|
283 static inline CxHashKey CX_HASH_KEY(cxstring str) { |
|
284 return cx_hash_key_cxstr(str); |
|
285 } |
|
286 |
|
287 static inline CxHashKey CX_HASH_KEY(cxmutstr str) { |
|
288 return cx_hash_key_mutstr(str); |
|
289 } |
|
290 |
|
291 static inline CxHashKey CX_HASH_KEY(const char *str) { |
|
292 return cx_hash_key_str(str); |
|
293 } |
|
294 |
|
295 static inline CxHashKey CX_HASH_KEY(const unsigned char *str) { |
|
296 return cx_hash_key_ustr(str); |
|
297 } |
|
298 |
|
299 static inline CxHashKey CX_HASH_KEY(uint32_t key) { |
|
300 return cx_hash_key_u32(key); |
|
301 } |
|
302 |
|
303 static inline CxHashKey CX_HASH_KEY(uint64_t key) { |
|
304 return cx_hash_key_u64(key); |
|
305 } |
273 #endif |
306 #endif |
274 |
307 |
275 #endif // UCX_HASH_KEY_H |
308 #endif // UCX_HASH_KEY_H |