HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SYS_PointerHash.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: SYS_PointerHash.h (SYS Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __SYS_PointerHash__
12 #define __SYS_PointerHash__
13 
14 #include "SYS_API.h"
15 #include "SYS_Types.h" // for uint64
16 #include <stddef.h> // for size_t
17 
18 static inline size_t
19 SYSpointerHash(const void *ptr)
20 {
21  // Simple hash so there are random values in the lower 16 bits
22  // We don't need a really sophisticated hash, just something to ensure the
23  // bottom bits aren't all zero.
24  uint64 v = (uint64)ptr;
25  return v ^ (v >> 29);
26 }
27 
28 #endif // __SYS_PointerHash__
const GLdouble * v
Definition: glcorearb.h:837
unsigned long long uint64
Definition: SYS_Types.h:117
auto ptr(T p) -> const void *
Definition: format.h:4331