cast to unsigned integers before bitshifting

bitshift on signed values is undefined in c++ standard.

http://gna.org/bugs/?25219
This commit is contained in:
gfgtdf 2017-02-24 01:10:57 +01:00 committed by GitHub
parent b949046236
commit 73b1d79691

View file

@ -57,7 +57,7 @@ const std::vector<map_location::DIRECTION> & map_location::default_dirs() {
std::size_t hash_value(map_location const & a){
std::hash<size_t> h;
return h( (a.x << 16) ^ a.y );
return h( (static_cast<uint32_t>(a.x) << 16) ^ static_cast<uint32_t>(a.y) );
}