diff --git a/src/common/JoyMap.hxx b/src/common/JoyMap.hxx index e83cb7530..42ef087dc 100644 --- a/src/common/JoyMap.hxx +++ b/src/common/JoyMap.hxx @@ -130,13 +130,14 @@ class JoyMap struct JoyHash { size_t operator()(const JoyMapping& m)const { - return std::hash()((uInt64(m.mode)) // 3 bit - ^ ((uInt64(m.button)) << 2) // 2 bits - ^ ((uInt64(m.axis)) << 4) // 1 bit - ^ ((uInt64(m.adir)) << 5) // 1 bit - ^ ((uInt64(m.hat)) << 6) // 1 bit - ^ ((uInt64(m.hdir)) << 7) // 2 bits - ); + return std::hash()((uInt64(m.mode)) // 3 bits + + ((uInt64(m.button)) * 7) // 3 bits + + (((uInt64(m.axis)) << 0) // 2 bits + | ((uInt64(m.adir)) << 2) // 2 bits + | ((uInt64(m.hat )) << 4) // 1 bit + | ((uInt64(m.hdir)) << 5) // 2 bits + ) * 61 + ); } }; diff --git a/src/common/KeyMap.hxx b/src/common/KeyMap.hxx index d789d58c7..f4405a968 100644 --- a/src/common/KeyMap.hxx +++ b/src/common/KeyMap.hxx @@ -104,12 +104,14 @@ class KeyMap struct KeyHash { size_t operator()(const Mapping& m) const { - return std::hash()((uInt64(m.mode)) // 3 bits - + ((uInt64(m.key)) * 7) // 8 bits - + (((uInt64((m.mod & KBDM_SHIFT) != 0) << 0)) // 1 bit - | ((uInt64((m.mod & KBDM_ALT ) != 0) << 1)) // 1 bit - | ((uInt64((m.mod & KBDM_GUI ) != 0) << 2)) // 1 bit - | ((uInt64((m.mod & KBDM_CTRL ) != 0) << 3))) * 2047); // 1 bit + return std::hash()((uInt64(m.mode)) // 3 bits + + ((uInt64(m.key)) * 7) // 8 bits + + (((uInt64((m.mod & KBDM_SHIFT) != 0) << 0)) // 1 bit + | ((uInt64((m.mod & KBDM_ALT ) != 0) << 1)) // 1 bit + | ((uInt64((m.mod & KBDM_GUI ) != 0) << 2)) // 1 bit + | ((uInt64((m.mod & KBDM_CTRL ) != 0) << 3)) // 1 bit + ) * 2047 + ); } };