Undefined Behavior fix.
Shifting bits into the sign-bit is unpredictable. Should be an unsigned type.
This commit is contained in:
parent
560e7a3d12
commit
3850700ce1
2 changed files with 2 additions and 2 deletions
|
@ -44,7 +44,7 @@ static void writeRaw(std::ostream& out, const T& data)
|
||||||
// Reads uncompressed vector<char> from file. Throws if length field is longer
|
// Reads uncompressed vector<char> from file. Throws if length field is longer
|
||||||
// than <max_length>.
|
// than <max_length>.
|
||||||
template<typename SizeType>
|
template<typename SizeType>
|
||||||
static SizeType VectorRead(std::istream& in, std::vector<char>& out, uint32_t max_length=(1<<31))
|
static SizeType VectorRead(std::istream& in, std::vector<char>& out, uint32_t max_length=(1u << 31))
|
||||||
{
|
{
|
||||||
SizeType length;
|
SizeType length;
|
||||||
readRaw(in, length);
|
readRaw(in, length);
|
||||||
|
|
|
@ -115,7 +115,7 @@ int jsInput::getInput() {
|
||||||
}
|
}
|
||||||
if(button_bits != 0) {
|
if(button_bits != 0) {
|
||||||
for(int i=0;i<=31;i++) {
|
for(int i=0;i<=31;i++) {
|
||||||
if( ( button_bits & (1 << i) ) > 0 ) {
|
if( ( button_bits & (1u << i) ) > 0 ) {
|
||||||
button=i;
|
button=i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue