/// Simple hash function ////////
| 58 | |
| 59 | //////// Simple hash function //////// |
| 60 | static NvBlastID generateIDFromString(const char* str) |
| 61 | { |
| 62 | uint32_t h[4] = { 5381, 5381, 5381, 5381 }; |
| 63 | int i = 0; |
| 64 | for (const char* ptr = str; *ptr; i = ((i + 1) & 3), ++ptr) |
| 65 | { |
| 66 | h[i] = ((h[i] << 5) + h[i]) ^ static_cast<uint32_t>(*ptr); |
| 67 | } |
| 68 | return *reinterpret_cast<NvBlastID*>(h); |
| 69 | } |
| 70 | |
| 71 | |
| 72 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |