Avoid 31-bit left shift of 32-bit signed values
This commit is contained in:
@@ -368,7 +368,7 @@ public:
|
|||||||
buttonCustom3 = 1 << 28,
|
buttonCustom3 = 1 << 28,
|
||||||
|
|
||||||
savedHiddenState = 1 << 30, // used internally
|
savedHiddenState = 1 << 30, // used internally
|
||||||
actionPane = 1 << 31 // used internally
|
actionPane = 1u << 31 // used internally
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@@ -235,7 +235,7 @@ int wxJoystick::GetButtonState() const
|
|||||||
|
|
||||||
bool wxJoystick::GetButtonState(unsigned int id) const
|
bool wxJoystick::GetButtonState(unsigned int id) const
|
||||||
{
|
{
|
||||||
if (id > sizeof(int) * 8)
|
if (id >= sizeof(int) * 8)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return (GetButtonState() & (1 << id)) != 0;
|
return (GetButtonState() & (1 << id)) != 0;
|
||||||
@@ -859,20 +859,20 @@ void* wxJoystickThread::Entry()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
//is the cookie a button?
|
//is the cookie a button?
|
||||||
if (nIndex < 40)
|
if (nIndex < 32)
|
||||||
{
|
{
|
||||||
if (hidevent.value)
|
if (hidevent.value)
|
||||||
{
|
{
|
||||||
pThis->m_buttons |= (1 << nIndex);
|
pThis->m_buttons |= (1u << nIndex);
|
||||||
wxevent.SetEventType(wxEVT_JOY_BUTTON_DOWN);
|
wxevent.SetEventType(wxEVT_JOY_BUTTON_DOWN);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pThis->m_buttons &= ~(1 << nIndex);
|
pThis->m_buttons &= ~(1u << nIndex);
|
||||||
wxevent.SetEventType(wxEVT_JOY_BUTTON_UP);
|
wxevent.SetEventType(wxEVT_JOY_BUTTON_UP);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxevent.SetButtonChange(1 << nIndex);
|
wxevent.SetButtonChange(1u << nIndex);
|
||||||
}
|
}
|
||||||
else if (nIndex == wxJS_AXIS_X)
|
else if (nIndex == wxJS_AXIS_X)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user