File tree 1 file changed +20
-26
lines changed 1 file changed +20
-26
lines changed Original file line number Diff line number Diff line change 13
13
#include < vector>
14
14
15
15
namespace NativeScript {
16
-
17
- struct SignatureHash {
18
-
19
- std::size_t operator ()(std::vector<const ffi_type*> signature) const {
20
- std::size_t seed = 0 ;
21
-
22
-
23
- for (size_t i = 0 ; i < signature.size (); i++) {
24
- seed <<= 4 ;
25
- seed |= signature[i]->type ;
26
- }
27
- return seed;
16
+
17
+ struct SignatureHash {
18
+
19
+ std::size_t operator ()(std::vector<const ffi_type*> signature) const {
20
+ std::size_t seed = 2166136261 ;
21
+
22
+ for (size_t i = 0 ; i < signature.size (); i++) {
23
+ seed = (seed ^ reinterpret_cast <size_t >(signature[i])) * 16777619U ;
28
24
}
29
-
30
- };
31
-
32
- class FFICache {
33
-
34
- public:
35
-
36
- std::unordered_map<std::vector<const ffi_type*>, std::shared_ptr<ffi_cif>, SignatureHash> cifCache;
37
-
38
- static FFICache *global ();
39
-
40
- };
41
-
42
- }
25
+ return seed;
26
+ }
27
+ };
28
+
29
+ class FFICache {
30
+
31
+ public:
32
+ std::unordered_map<std::vector<const ffi_type*>, std::shared_ptr<ffi_cif>, SignatureHash> cifCache;
33
+
34
+ static FFICache* global ();
35
+ };
43
36
37
+ } // namespace NativeScript
44
38
45
39
#endif /* FFICache_h */
You can’t perform that action at this time.
0 commit comments