Remove redundant bounds checks

This commit is contained in:
Chris Thrasher 2024-04-26 23:24:28 -06:00
parent d663dd1cc9
commit c973a9b9ac
No known key found for this signature in database
GPG Key ID: 56FB686C9DFC8E2C

View File

@ -550,9 +550,6 @@ namespace sf::priv::InputImpl
bool isKeyPressed(Keyboard::Key key) bool isKeyPressed(Keyboard::Key key)
{ {
const std::lock_guard lock(inputMutex); const std::lock_guard lock(inputMutex);
if ((static_cast<int>(key) < 0) || (static_cast<int>(key) >= static_cast<int>(keyMap.size())))
return false;
update(); update();
return keyMap[key]; return keyMap[key];
} }
@ -605,9 +602,6 @@ void setVirtualKeyboardVisible(bool /*visible*/)
bool isMouseButtonPressed(Mouse::Button button) bool isMouseButtonPressed(Mouse::Button button)
{ {
const std::lock_guard lock(inputMutex); const std::lock_guard lock(inputMutex);
if ((static_cast<int>(button) < 0) || (static_cast<int>(button) >= static_cast<int>(mouseMap.size())))
return false;
update(); update();
return mouseMap[button]; return mouseMap[button];
} }