I have a 64 bit number with a bunch of bits set depending on a certain state of a render pass, and another 64 bit number that stores bits depending on what the pipeline state is. Each change in any bit in either numbers should be a change in state and therefore a different key. All the information in both numbers should be unique in retrieving the value from a map. How can I do this? How do you hash this? I don't like the idea of looping 16 to hash this. I am using c++ and was hoping I could use the key with std::unordered_map which is a hash map.
Asked
Active
Viewed 52 times
0
-
Consider using `std::pair` and a hash for it from boost. Or just write your own hash for it. Actually easy to do. – doug Jan 01 '23 at 17:56
-
You can just create a `struct MyKey` which contains two `uint64_t`'s representing your two values, and then use that as the key-type for your `unordered_map`, as described here: https://stackoverflow.com/questions/17016175/c-unordered-map-using-a-custom-class-type-as-the-key – Jeremy Friesner Jan 01 '23 at 23:16