Hexagon: Avoid left shifting negative values (it's UB)

Found by ubsan.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240521 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Justin Bogner 2015-06-24 06:00:53 +00:00
parent cac03419a6
commit ef4ff212af

View File

@ -34,7 +34,7 @@ public:
HexagonResource(unsigned s) { setUnits(s); };
void setUnits(unsigned s) {
Slots = s & ~(-1 << HEXAGON_PACKET_SIZE);
Slots = s & ~(~0U << HEXAGON_PACKET_SIZE);
setWeight(s);
};
unsigned setWeight(unsigned s);